aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_settracefunc.rb
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-19 09:17:21 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-19 09:17:21 +0000
commit59bdf7eac8dfaf740e2c87da93efdfc96b1c9469 (patch)
tree516f3fdd1627b5d77429102667c26a11882a9b83 /test/ruby/test_settracefunc.rb
parentc4bbf190fdff49686fe67310728831e0777bc04b (diff)
downloadruby-59bdf7eac8dfaf740e2c87da93efdfc96b1c9469.tar.gz
* vm_core.h: add VM_FRAME_MAGIC_RESCUE to recognize normal block or
rescue clause. * vm.c (vm_exec): use VM_FRAME_MAGIC_RESCUE on at rescue/ensure. * test/ruby/test_settracefunc.rb: should not invoke b_return at rescue clause. [Bug #9957] * vm_dump.c (control_frame_dump): check VM_FRAME_MAGIC_RESCUE. * vm_dump.c (vm_stack_dump_each): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46463 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_settracefunc.rb')
-rw-r--r--test/ruby/test_settracefunc.rb36
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