From 89bfc9b70b05ac598d24bb712222b79fb9af1880 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 13 Mar 2015 06:03:25 +0000 Subject: io.c: don't raise after close * io.c (rb_io_close_read, rb_io_close_write): don't raise after close same as IO#close. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49961 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_io.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test') diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index 600373a06c..81b99d55d1 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -1364,6 +1364,9 @@ class TestIO < Test::Unit::TestCase f.close_read f.write "foobarbaz" assert_raise(IOError) { f.read } + assert_nothing_raised(IOError) {f.close_read} + assert_nothing_raised(IOError) {f.close} + assert_nothing_raised(IOError) {f.close_read} end end @@ -1371,6 +1374,9 @@ class TestIO < Test::Unit::TestCase with_pipe do |r, w| r.close_read assert_raise(Errno::EPIPE) { w.write "foobarbaz" } + assert_nothing_raised(IOError) {r.close_read} + assert_nothing_raised(IOError) {r.close} + assert_nothing_raised(IOError) {r.close_read} end end @@ -1398,6 +1404,9 @@ class TestIO < Test::Unit::TestCase f.write "foobarbaz" f.close_write assert_equal("foobarbaz", f.read) + assert_nothing_raised(IOError) {f.close_write} + assert_nothing_raised(IOError) {f.close} + assert_nothing_raised(IOError) {f.close_write} end end -- cgit v1.2.3