summaryrefslogtreecommitdiff
path: root/test/zlib
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-07-03 22:08:04 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-07-03 22:08:04 +0000
commit0e9b0c8c84e08bdb7a8308dfdafee2346ad9995e (patch)
tree1e69b731b9477a49098d0cebbf624a54442faacb /test/zlib
parent98cbc7070da28a544b68e6b9b311b90978c14e05 (diff)
* test/zlib/test_zlib.rb (test_inflate_partial_input): Added test for
inflating incomplete zlib streams. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36295 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/zlib')
-rw-r--r--test/zlib/test_zlib.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/zlib/test_zlib.rb b/test/zlib/test_zlib.rb
index 699b65a..61e24e4 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"