Project

General

Profile

Bug #8886 » raise_exception_inside_raise_method.patch

deivid (David Rodríguez), 10/11/2013 10:42 PM

View differences:

eval.c
VALUE self = cfp->self;
ID mid = cfp->me->called_id;
th->cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(th->cfp);
setup_exception(th, TAG_RAISE, mesg);
th->cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(th->cfp);
EXEC_EVENT_HOOK(th, RUBY_EVENT_C_RETURN, self, mid, klass, Qnil);
rb_thread_raised_clear(th);
JUMP_TAG(TAG_RAISE);
test/minitest/test_minitest_unit.rb
1) Error:
#<Class:0xXXX>#test_error:
RuntimeError: unhandled exception
FILE:LINE:in \`raise\'
FILE:LINE:in \`test_error\'
2 tests, 1 assertions, 0 failures, 1 errors, 0 skips
......
1) Error:
#<Class:0xXXX>#test_something:
RuntimeError: unhandled exception
FILE:LINE:in \`raise\'
FILE:LINE:in \`teardown\'
1 tests, 1 assertions, 0 failures, 1 errors, 0 skips
......
Class: <SyntaxError>
Message: <\"icky\">
---Backtrace---
FILE:LINE:in \`raise\'
FILE:LINE:in \`test_assert_raises_triggered_different\'
---------------
EOM
......
Class: <SyntaxError>
Message: <\"icky\">
---Backtrace---
FILE:LINE:in \`raise\'
FILE:LINE:in \`test_assert_raises_triggered_different_msg\'
---------------
EOM
......
Class: <AnError>
Message: <\"AnError\">
---Backtrace---
FILE:LINE:in \`raise\'
FILE:LINE:in \`test_assert_raises_triggered_subclass\'
---------------
EOM
test/ruby/test_backtrace.rb
e.backtrace
end
}.resume
assert_equal(1, bt.size)
assert_equal(2, bt.size)
assert_match(/.+:\d+:.+/, bt[0])
end
test/ruby/test_settracefunc.rb
events.shift)
assert_equal(["c-return", 5, :backtrace, Exception],
events.shift)
assert_equal(["raise", 5, :test_raise, TestSetTraceFunc],
assert_equal(["raise", 5, :raise, Kernel],
events.shift)
assert_equal(["c-return", 5, :raise, Kernel],
events.shift)
......
[:c_return,20, "xyzzy", Exception, :exception, RuntimeError, :outer, raised_exc],
[:c_call, 20, "xyzzy", Exception, :backtrace, raised_exc, :outer, :nothing],
[:c_return,20, "xyzzy", Exception, :backtrace, raised_exc, :outer, nil],
[:raise, 20, "xyzzy", TestSetTraceFunc, :trace_by_tracepoint, self, :outer, raised_exc],
[:raise, 20, "xyzzy", Kernel, :raise, self, :outer, raised_exc],
[:c_return,20, "xyzzy", Kernel, :raise, self, :outer, nil],
[:c_call, 20, "xyzzy", Module, :===, RuntimeError,:outer, :nothing],
[:c_return,20, "xyzzy", Module, :===, RuntimeError,:outer, true],
(2-2/2)