diff options
Diffstat (limited to 'test/zlib')
-rw-r--r-- | test/zlib/test_zlib.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/zlib/test_zlib.rb b/test/zlib/test_zlib.rb index ccb8b3834e..464141f7d4 100644 --- a/test/zlib/test_zlib.rb +++ b/test/zlib/test_zlib.rb @@ -1457,6 +1457,13 @@ if defined? Zlib assert_raise(Zlib::GzipFile::Error){ Zlib.gunzip(src) } end + # Zlib.gunzip input is always considered a binary string, regardless of its String#encoding. + def test_gunzip_encoding + # vvvvvvvv = mtime, but valid UTF-8 string of U+0080 + src = %w[1f8b0800c28000000003cb48cdc9c9070086a6103605000000].pack("H*").force_encoding('UTF-8') + assert_equal 'hello', Zlib.gunzip(src.freeze) + end + def test_gunzip_no_memory_leak assert_no_memory_leak(%[-rzlib], "#{<<~"{#"}", "#{<<~'};'}") d = Zlib.gzip("data") |