summaryrefslogtreecommitdiff
path: root/test/zlib
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-12-10 08:26:40 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-12-10 08:26:40 +0000
commitf46a1377464d080ccbfb2b943d0fe7df18500e6a (patch)
tree46b9a19616bda92969b59bfbff83d35f83cbc1ca /test/zlib
parent0c83666c6ceb9dae06055150da02d16ed20f4781 (diff)
zlib.c: replace with substring
* ext/zlib/zlib.c (zstream_discard_input): replace with unread portion substring, not modifying the input buffer directly. [ruby-core:78567] [Bug #13021] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57042 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/zlib')
-rw-r--r--test/zlib/test_zlib.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/test/zlib/test_zlib.rb b/test/zlib/test_zlib.rb
index 60fb84d..7f9ec98 100644
--- a/test/zlib/test_zlib.rb
+++ b/test/zlib/test_zlib.rb
@@ -1128,25 +1128,25 @@ if defined? Zlib
end
def test_gzip
- actual = Zlib.gzip("foo")
+ actual = Zlib.gzip("foo".freeze)
actual[4, 4] = "\x00\x00\x00\x00" # replace mtime
actual[9] = "\xff" # replace OS
expected = %w[1f8b08000000000000ff4bcbcf07002165738c03000000].pack("H*")
assert_equal expected, actual
- actual = Zlib.gzip("foo", 0)
+ actual = Zlib.gzip("foo".freeze, 0)
actual[4, 4] = "\x00\x00\x00\x00" # replace mtime
actual[9] = "\xff" # replace OS
expected = %w[1f8b08000000000000ff010300fcff666f6f2165738c03000000].pack("H*")
assert_equal expected, actual
- actual = Zlib.gzip("foo", 9)
+ actual = Zlib.gzip("foo".freeze, 9)
actual[4, 4] = "\x00\x00\x00\x00" # replace mtime
actual[9] = "\xff" # replace OS
expected = %w[1f8b08000000000002ff4bcbcf07002165738c03000000].pack("H*")
assert_equal expected, actual
- actual = Zlib.gzip("foo", 9, Zlib::FILTERED)
+ actual = Zlib.gzip("foo".freeze, 9, Zlib::FILTERED)
actual[4, 4] = "\x00\x00\x00\x00" # replace mtime
actual[9] = "\xff" # replace OS
expected = %w[1f8b08000000000002ff4bcbcf07002165738c03000000].pack("H*")
@@ -1155,7 +1155,7 @@ if defined? Zlib
def test_gunzip
src = %w[1f8b08000000000000034bcbcf07002165738c03000000].pack("H*")
- assert_equal 'foo', Zlib.gunzip(src)
+ assert_equal 'foo', Zlib.gunzip(src.freeze)
src = %w[1f8b08000000000000034bcbcf07002165738c03000001].pack("H*")
assert_raise(Zlib::GzipFile::LengthError){ Zlib.gunzip(src) }