Skip to content

Commit

Permalink
Add specs for rescue even in TracePoint
Browse files Browse the repository at this point in the history
  • Loading branch information
herwinw committed Nov 29, 2024
1 parent 11d86bd commit 5b63a0c
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions core/tracepoint/raised_exception_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,22 @@
raised_exception.should equal(error_result)
end
end

ruby_version_is "3.3" do
it 'returns value from exception rescued on the :rescue event' do
raised_exception, error_result = nil
trace = TracePoint.new(:rescue) { |tp|
next unless TracePointSpec.target_thread?
raised_exception = tp.raised_exception
}
trace.enable do
begin
raise StandardError
rescue => e
error_result = e
end
raised_exception.should equal(error_result)
end
end
end
end

0 comments on commit 5b63a0c

Please sign in to comment.