diff options
Diffstat (limited to 'test/zlib/test_zlib.rb')
-rw-r--r-- | test/zlib/test_zlib.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/zlib/test_zlib.rb b/test/zlib/test_zlib.rb index 7d703d15e4..c58eafe112 100644 --- a/test/zlib/test_zlib.rb +++ b/test/zlib/test_zlib.rb @@ -446,6 +446,30 @@ if defined? Zlib end class TestZlibGzipFile < Test::Unit::TestCase + def test_gzip_reader_zcat + Tempfile.create("test_zlib_gzip_file_to_io") {|t| + gz = Zlib::GzipWriter.new(t) + gz.print("foo") + gz.close + t = File.open(t.path, 'ab') + gz = Zlib::GzipWriter.new(t) + gz.print("bar") + gz.close + + results = [] + t = File.open(t.path) + Zlib::GzipReader.zcat(t) do |str| + results << str + end + assert_equal(["foo", "bar"], results) + t.close + + t = File.open(t.path) + assert_equal("foobar", Zlib::GzipReader.zcat(t)) + t.close + } + end + def test_to_io Tempfile.create("test_zlib_gzip_file_to_io") {|t| t.close |