summaryrefslogtreecommitdiff
path: root/test/zlib
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-11 00:29:52 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-11 00:29:52 +0000
commit403dc5357dddd1cd8af4b73bc658fcbf3b91643c (patch)
treecc9a69bb5fc1164a74b7005cf42fc81d5267ac75 /test/zlib
parente1d113cbefc6e3797a0bb4860be6aa7ffe84e379 (diff)
* ext/zlib/zlib.c (do_inflate): Inflate more data if buffered data
exists. Allows Zlib::Inflate#set_dictionary to work. [ruby-trunk - Bug #5929] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/zlib')
-rw-r--r--test/zlib/test_zlib.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/zlib/test_zlib.rb b/test/zlib/test_zlib.rb
index 8c2fbde..da4f74c 100644
--- a/test/zlib/test_zlib.rb
+++ b/test/zlib/test_zlib.rb
@@ -195,6 +195,29 @@ if defined? Zlib
z << "foo" # ???
end
+ def test_inflate_dictionary
+ dictionary = "foo"
+
+ deflate = Zlib::Deflate.new
+ deflate.set_dictionary dictionary
+ compressed = deflate.deflate "foofoofoo", Zlib::FINISH
+ deflate.close
+
+ out = nil
+ inflate = Zlib::Inflate.new
+
+ begin
+ out = inflate.inflate compressed
+
+ flunk "Zlib::NeedDict was not raised"
+ rescue Zlib::NeedDict
+ inflate.set_dictionary dictionary
+ out = inflate.inflate ""
+ end
+
+ assert_equal "foofoofoo", out
+ end
+
def test_sync
z = Zlib::Deflate.new
s = z.deflate("foo" * 1000, Zlib::FULL_FLUSH)