summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-08-09 08:31:28 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-08-09 08:31:28 +0000
commit2132fb9fd1fb8d32e5f1ae681fafbf295b91eac5 (patch)
treef3b231a3381a88dc086a19459ae745b6a82deec4 /test
parentf6d9f6fd2a7ad2f20472f3704ae7d4e810627c54 (diff)
merge revision(s) 57415,57474: [Backport #13239]
eval.c: copy special exception * eval.c (setup_exception): make unfrozen copy of special exception before setting up a cause. test_io.rb: separate a test * test/ruby/test_io.rb (test_closed_stream_in_rescue): run in a separated process. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@59538 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_io.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb
index 9a443318b4..4dd515da39 100644
--- a/test/ruby/test_io.rb
+++ b/test/ruby/test_io.rb
@@ -3357,5 +3357,28 @@ End
end
assert_equal(true, closed, "#{bug13158}: stream should be closed")
end
+
+ def test_closed_stream_in_rescue
+ assert_separately([], "#{<<-"begin;"}\n#{<<~"end;"}")
+ begin;
+ 10.times do
+ assert_nothing_raised(RuntimeError, /frozen IOError/) do
+ IO.pipe do |r, w|
+ th = Thread.start {r.close}
+ r.gets
+ rescue IOError
+ # swallow pending exceptions
+ begin
+ sleep 0.001
+ rescue IOError
+ retry
+ end
+ ensure
+ th.kill.join
+ end
+ end
+ end
+ end;
+ end
end
end