Skip to content

Commit

Permalink
Add spec for backtrace from rescue that only captures $!.
Browse files Browse the repository at this point in the history
See #4240
  • Loading branch information
headius committed Oct 21, 2016
1 parent bc7c127 commit b610805
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions spec/ruby/core/exception/backtrace_spec.rb
Expand Up @@ -46,4 +46,14 @@
line.should =~ /^[^ ]+\:\d+(:in `[^`]+')?$/
end
end

it "produces a backtrace for an exception captured using $!" do
exception = begin
raise
rescue RuntimeError
$!
end

exception.backtrace.first.should =~ /backtrace_spec/
end
end

0 comments on commit b610805

Please sign in to comment.