2016-03-01 16:59:30 -05:00
|
|
|
describe "wtf?!" do
|
|
|
|
let(:tester) do
|
|
|
|
pry_tester do
|
|
|
|
def last_exception=(ex)
|
|
|
|
@pry.last_exception = ex
|
|
|
|
end
|
|
|
|
|
|
|
|
def last_exception
|
|
|
|
@pry.last_exception
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it "unwinds nested exceptions" do
|
2019-03-03 10:37:58 -05:00
|
|
|
if Gem::Version.new(RUBY_VERSION) <= Gem::Version.new('2.0.0')
|
|
|
|
skip('Exception#cause is not supported')
|
|
|
|
end
|
2016-03-01 16:59:30 -05:00
|
|
|
|
|
|
|
begin
|
|
|
|
begin
|
|
|
|
begin
|
|
|
|
raise 'inner'
|
|
|
|
rescue RuntimeError
|
|
|
|
raise 'outer'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
rescue RuntimeError => ex
|
|
|
|
tester.last_exception = ex
|
|
|
|
end
|
|
|
|
|
|
|
|
expect(tester.eval('wtf -v')).to match(/
|
|
|
|
Exception:\sRuntimeError:\souter
|
|
|
|
.+
|
|
|
|
Caused\sby:\sRuntimeError:\sinner
|
|
|
|
/xm)
|
|
|
|
end
|
|
|
|
end
|