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-06-26 14:50:14 +02:00
parent f616e81637
commit d3d5ef0cca
74 changed files with 1201 additions and 324 deletions

View file

@ -102,6 +102,30 @@ describe "Thread#raise on a sleeping thread" do
raised_again.backtrace.first.should_not include("#{__FILE__}:#{raise_again_line}:")
end
end
it "calls #exception in both the caller and in the target thread" do
cls = Class.new(Exception) do
attr_accessor :log
def initialize(*args)
@log = [] # This is shared because the super #exception uses a shallow clone
super
end
def exception(*args)
@log << [self, Thread.current, args]
super
end
end
exc = cls.new
@thr.raise exc, "Thread#raise #exception spec"
@thr.join
ScratchPad.recorded.should.is_a?(cls)
exc.log.should == [
[exc, Thread.current, ["Thread#raise #exception spec"]],
[ScratchPad.recorded, @thr, []]
]
end
end
describe "Thread#raise on a running thread" do