Skip to content

Commit 2ca97d4

Browse files
herwinwandrykonchin
authored andcommitted
Add specs for rescue even in TracePoint
1 parent 11d86bd commit 2ca97d4

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

core/tracepoint/raised_exception_spec.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,22 @@
1717
raised_exception.should equal(error_result)
1818
end
1919
end
20+
21+
ruby_version_is "3.3" do
22+
it 'returns value from exception rescued on the :rescue event' do
23+
raised_exception, error_result = nil
24+
trace = TracePoint.new(:rescue) { |tp|
25+
next unless TracePointSpec.target_thread?
26+
raised_exception = tp.raised_exception
27+
}
28+
trace.enable do
29+
begin
30+
raise StandardError
31+
rescue => e
32+
error_result = e
33+
end
34+
raised_exception.should equal(error_result)
35+
end
36+
end
37+
end
2038
end

0 commit comments

Comments
 (0)