File tree 2 files changed +20
-1
lines changed
2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,26 @@ require "spec"
2
2
require " flate"
3
3
4
4
module Flate
5
+ describe Reader do
6
+ it " should read byte by byte (#4192)" do
7
+ io = IO ::Memory .new
8
+ " cbc9cc4b350402ae1c20c30808b800" .scan(/../ ).each do |match |
9
+ io.write_byte match[0 ].to_u8(16 )
10
+ end
11
+ io.rewind
12
+
13
+ reader = Reader .new(io)
14
+
15
+ str = String ::Builder .build do |builder |
16
+ while b = reader.read_byte
17
+ builder.write_byte b
18
+ end
19
+ end
20
+
21
+ str.should eq(" line1111\n line2222\n " )
22
+ end
23
+ end
24
+
5
25
describe Writer do
6
26
it " should be able to write" do
7
27
message = " this is a test string !!!!\n "
Original file line number Diff line number Diff line change @@ -77,7 +77,6 @@ class Flate::Reader
77
77
@stream .next_in = @buf .to_unsafe
78
78
@stream .avail_in = @io .read(@buf .to_slice).to_u32
79
79
end
80
- return 0 if @stream .avail_in == 0
81
80
end
82
81
83
82
old_avail_in = @stream .avail_in
You can’t perform that action at this time.
0 commit comments