summaryrefslogtreecommitdiff
path: root/test/zlib
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-03-08 13:52:51 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-03-08 13:52:51 +0000
commitb6d5ce7975667cc32d7d86a992d5206627e5ff73 (patch)
tree1802023dc4f9a29204373e917d10d24d4b68d186 /test/zlib
parent5b06e833453dcbbf4da69a5f98d50e565d4300ef (diff)
* ext/zlib/zlib.c (rb_gzfile_close): Don't raise on double
close for consistent to IO#close. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49893 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/zlib')
-rw-r--r--test/zlib/test_zlib.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/zlib/test_zlib.rb b/test/zlib/test_zlib.rb
index 3a2fe92..63bbd27 100644
--- a/test/zlib/test_zlib.rb
+++ b/test/zlib/test_zlib.rb
@@ -962,6 +962,19 @@ if defined? Zlib
assert_equal(content, read_size)
}
end
+
+ def test_double_close
+ Tempfile.create("test_zlib_gzip_reader_close") {|t|
+ t.binmode
+ content = "foo"
+ Zlib::GzipWriter.wrap(t) {|gz| gz.print(content) }
+ r = Zlib::GzipReader.open(t.path)
+ assert_equal(content, r.read)
+ assert_nothing_raised { r.close }
+ assert_nothing_raised { r.close }
+ }
+ end
+
end
class TestZlibGzipWriter < Test::Unit::TestCase
@@ -1022,6 +1035,15 @@ if defined? Zlib
assert_equal("foo", Zlib::GzipReader.open(t.path) {|gz| gz.read })
}
end
+
+ def test_double_close
+ Tempfile.create("test_zlib_gzip_reader_close") {|t|
+ t.binmode
+ w = Zlib::GzipWriter.wrap(t)
+ assert_nothing_raised { w.close }
+ assert_nothing_raised { w.close }
+ }
+ end
end
class TestZlib < Test::Unit::TestCase