diff --git a/ChangeLog b/ChangeLog index 97077445ec..79a88427ce 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Wed Jul 4 07:05:59 2012 Eric Hodel + + * test/zlib/test_zlib.rb (test_inflate_partial_input): Added test for + inflating incomplete zlib streams. + Tue Jul 3 23:14:16 2012 Naohisa Goto * gc.c (ATOMIC_SIZE_EXCHANGE): fix function name on Solaris [Bug #6689] diff --git a/test/zlib/test_zlib.rb b/test/zlib/test_zlib.rb index 699b65a5f4..61e24e4d44 100644 --- a/test/zlib/test_zlib.rb +++ b/test/zlib/test_zlib.rb @@ -212,6 +212,25 @@ if defined? Zlib z << "foo" # ??? end + def test_inflate_partial_input + deflated = Zlib::Deflate.deflate "\0" + + a = deflated[0...2] + b = deflated[2..-1] + + z = Zlib::Inflate.new + + inflated = "" + + deflated.each_char do |byte| + inflated << z.inflate(byte) + end + + inflated << z.finish + + assert_equal "\0", inflated + end + def test_inflate_dictionary dictionary = "foo"