Skip to content

Commit ee372aa

Browse files
committed
test/zlib/test_zlib.rb: Set binmode to test output file
Seems like the test `TestZlibGzipFile#test_gzip_reader_zcat` fails when the timestamp has `\n\n`. https://ci.appveyor.com/project/ruby/ruby/builds/38597932 ``` 1) Error: TestZlibGzipFile#test_gzip_reader_zcat: Zlib::DataError: invalid distance too far back C:/projects/ruby/test/zlib/test_zlib.rb:522:in `initialize' C:/projects/ruby/test/zlib/test_zlib.rb:522:in `new' C:/projects/ruby/test/zlib/test_zlib.rb:522:in `zcat' C:/projects/ruby/test/zlib/test_zlib.rb:522:in `block (2 levels) in test_gzip_reader_zcat' C:/projects/ruby/test/zlib/test_zlib.rb:521:in `open' C:/projects/ruby/test/zlib/test_zlib.rb:521:in `block in test_gzip_reader_zcat' C:/projects/ruby/lib/tempfile.rb:358:in `create' C:/projects/ruby/test/zlib/test_zlib.rb:510:in `test_gzip_reader_zcat' ``` The test time is around 2021-04-08 04:40 +0900. Maybe the following time should trigger the bug. ``` irb(main):001:0> Time.at(1617824266) => 2021-04-08 04:37:46 +0900 irb(main):002:0> [1617824266].pack("V") => "\n\nn`" ```
1 parent ec35581 commit ee372aa

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

test/zlib/test_zlib.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,7 @@ def test_set_dictionary
508508
class TestZlibGzipFile < Test::Unit::TestCase
509509
def test_gzip_reader_zcat
510510
Tempfile.create("test_zlib_gzip_file_to_io") {|t|
511+
t.binmode
511512
gz = Zlib::GzipWriter.new(t)
512513
gz.print("foo")
513514
gz.close

0 commit comments

Comments
 (0)