diff options
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_settracefunc.rb | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/ruby/test_settracefunc.rb b/test/ruby/test_settracefunc.rb index 970c1a650e..72e114398b 100644 --- a/test/ruby/test_settracefunc.rb +++ b/test/ruby/test_settracefunc.rb @@ -1202,4 +1202,40 @@ class TestSetTraceFunc < Test::Unit::TestCase raise if stack != [:p, :hash, :inspect] }, '[Bug #9940]' end + + def method_test_rescue_should_not_cause_b_return + begin + raise + rescue + return + end + end + + def method_test_ensure_should_not_cause_b_return + begin + raise + ensure + return + end + end + + def test_rescue_and_ensure_should_not_cause_b_return + curr_thread = Thread.current + trace = TracePoint.new(:b_call, :b_return){ + next if curr_thread != Thread.current + flunk("Should not reach here because there is no block.") + } + + begin + trace.enable + method_test_rescue_should_not_cause_b_return + begin + method_test_ensure_should_not_cause_b_return + rescue + # ignore + end + ensure + trace.disable + end + end end |