summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-03-12 18:01:22 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-03-12 18:01:22 +0000
commitf1a2033d759cda9806dd667a077235e6df80dabf (patch)
treea9c047f0995088668e86d07445b5be25f93166e5 /test
parenta1b1d832f4b1163d96ba7c1378290e3ff7507364 (diff)
merge revision(s) 57415,57463,57474:
eval.c: copy special exception * eval.c (setup_exception): make unfrozen copy of special exception before setting up a cause. reduce iterations for slower machines 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_4@57939 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_io.rb27
1 files changed, 26 insertions, 1 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb
index f1e5acac67..a6ab981a9c 100644
--- a/test/ruby/test_io.rb
+++ b/test/ruby/test_io.rb
@@ -3370,7 +3370,7 @@ __END__
assert_separately([], "#{<<-"begin;"}\n#{<<-"end;"}")
bug13076 = '[ruby-core:78845] [Bug #13076]'
begin;
- 100.times do |i|
+ 10.times do |i|
a = []
t = []
10.times do
@@ -3483,5 +3483,30 @@ __END__
assert_equal(["foo\n", "bar\n", "baz\n"], IO.readlines(t.path))
}
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|
+ begin
+ 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
end