mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
4956376f13
I realise that some code might be less readable now, but now that we set a good default limit, we protect the codebase from further mess. It's important to do this to prevent adding more mess to already messy code that we have. :doctor:
37 lines
725 B
Ruby
37 lines
725 B
Ruby
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
|
|
if Gem::Version.new(RUBY_VERSION) <= Gem::Version.new('2.0.0')
|
|
skip('Exception#cause is not supported')
|
|
end
|
|
|
|
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
|