diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-08-31 08:14:15 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-08-31 08:14:15 +0000 |
commit | b10c3b6d51d7fb0597670d88a537d713b445098e (patch) | |
tree | eac8836aaeea3d68ea97e76d1ec8b8db87423dd6 /test/ruby | |
parent | 3ed06c80eb01000bc293c5cd88a09e92a3c15904 (diff) |
merge revision(s) 46465,46469,46484: [Backport #9961]
* vm.c (rb_vm_rewind_cfp): add new function to rewind specified cfp
with invoking RUBY_EVENT_C_RETURN.
[Bug #9961]
* vm_core.h: ditto.
* eval.c (rb_protect): use it.
* eval.c (rb_rescue2): ditto.
* vm_eval.c (rb_iterate): ditto.
* test/ruby/test_settracefunc.rb: add a test.
* vm_core.h (rb_name_err_mesg_new):
* vm_eval.c (rb_catch_protect): fix same problem of [Bug #9961].
* vm_eval.c (rb_iterate): ditto.
* vm_core.h (rb_vm_rewind_cfp): add the prototype declaration.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@47342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_settracefunc.rb | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/test/ruby/test_settracefunc.rb b/test/ruby/test_settracefunc.rb index 831923c358..5e9cafcfba 100644 --- a/test/ruby/test_settracefunc.rb +++ b/test/ruby/test_settracefunc.rb @@ -1184,6 +1184,57 @@ class TestSetTraceFunc < Test::Unit::TestCase assert_equal call_events, return_events.reverse, message end + def test_rb_rescue + events = [] + curr_thread = Thread.current + TracePoint.new(:b_call, :b_return, :c_call, :c_return){|tp| + next if curr_thread != Thread.current + events << [tp.event, tp.method_id] + }.enable do + begin + -Numeric.new + rescue => e + # ignore + end + end + + assert_equal [ + [:b_call, :test_rb_rescue], + [:c_call, :new], + [:c_call, :initialize], + [:c_return, :initialize], + [:c_return, :new], + [:c_call, :-@], + [:c_call, :coerce], + [:c_call, :to_s], + [:c_return, :to_s], + [:c_call, :new], + [:c_call, :initialize], + [:c_return, :initialize], + [:c_return, :new], + [:c_call, :exception], + [:c_return, :exception], + [:c_call, :backtrace], + [:c_return, :backtrace], + [:c_return, :coerce], # don't miss it! + [:c_call, :to_s], + [:c_return, :to_s], + [:c_call, :to_s], + [:c_return, :to_s], + [:c_call, :new], + [:c_call, :initialize], + [:c_return, :initialize], + [:c_return, :new], + [:c_call, :exception], + [:c_return, :exception], + [:c_call, :backtrace], + [:c_return, :backtrace], + [:c_return, :-@], + [:c_call, :===], + [:c_return, :===], + [:b_return, :test_rb_rescue]], events + end + def test_b_call_with_redo assert_consistent_call_return do i = 0 |