summaryrefslogtreecommitdiff
path: root/test/zlib
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-11 00:37:44 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-11 00:37:44 +0000
commit1516f8eb9f1c3957d5d97c85e35fdefade9ae137 (patch)
treebb696ce3e45ceb308a48d91c12592ff0b0acfaa3 /test/zlib
parent403dc5357dddd1cd8af4b73bc658fcbf3b91643c (diff)
* ext/zlib/zlib.c (rb_inflate_add_dictionary): Added
Zlib::Inflate#add_dictionary to allow users to pre-specify for using during #inflate. [ruby-trunk - Feature #5937] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34553 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/zlib')
-rw-r--r--test/zlib/test_zlib.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/zlib/test_zlib.rb b/test/zlib/test_zlib.rb
index da4f74c..b526d24 100644
--- a/test/zlib/test_zlib.rb
+++ b/test/zlib/test_zlib.rb
@@ -185,6 +185,23 @@ if defined? Zlib
assert_equal("foo", z.finish)
end
+ def test_add_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
+ inflate.add_dictionary "foo"
+
+ out = inflate.inflate compressed
+
+ assert_equal "foofoofoo", out
+ end
+
def test_inflate
s = Zlib::Deflate.deflate("foo")
z = Zlib::Inflate.new