1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
This commit is contained in:
Benoit Daloze 2022-03-28 17:47:04 +02:00
parent ae650f0372
commit 8db4f25bf4
41 changed files with 821 additions and 56 deletions

View file

@ -66,6 +66,26 @@ describe :thread_exit, shared: true do
ScratchPad.recorded.should == nil
end
it "does not reset $!" do
ScratchPad.record []
exc = RuntimeError.new("foo")
thread = Thread.new do
begin
raise exc
ensure
ScratchPad << $!
begin
Thread.current.send(@method)
ensure
ScratchPad << $!
end
end
end
thread.join
ScratchPad.recorded.should == [exc, exc]
end
it "cannot be rescued" do
thread = Thread.new do
begin
@ -73,7 +93,7 @@ describe :thread_exit, shared: true do
rescue Exception
ScratchPad.record :in_rescue
end
ScratchPad.record :end_of_thread_block
ScratchPad.record :end_of_thread_block
end
thread.join