зеркало из https://github.com/github/ruby.git
Родитель
8e38d4c78c
Коммит
8b2e1ca10e
4
error.c
4
error.c
|
@ -970,11 +970,11 @@ exc_exception(int argc, VALUE *argv, VALUE self)
|
|||
{
|
||||
VALUE exc;
|
||||
|
||||
argc = rb_check_arity(argc, 0, 1);
|
||||
if (argc == 0) return self;
|
||||
if (argc == 1 && self == argv[0]) return self;
|
||||
exc = rb_obj_clone(self);
|
||||
exc_initialize(argc, argv, exc);
|
||||
|
||||
rb_ivar_set(exc, id_mesg, argv[0]);
|
||||
return exc;
|
||||
}
|
||||
|
||||
|
|
|
@ -518,6 +518,18 @@ end.join
|
|||
end;
|
||||
end
|
||||
|
||||
def test_backtrace_by_exception
|
||||
begin
|
||||
line = __LINE__; raise "foo"
|
||||
rescue => e
|
||||
end
|
||||
e2 = e.exception("bar")
|
||||
assert_not_equal(e.message, e2.message)
|
||||
assert_equal(e.backtrace, e2.backtrace)
|
||||
loc = e2.backtrace_locations[0]
|
||||
assert_equal([__FILE__, line], [loc.path, loc.lineno])
|
||||
end
|
||||
|
||||
Bug4438 = '[ruby-core:35364]'
|
||||
|
||||
def test_rescue_single_argument
|
||||
|
|
Загрузка…
Ссылка в новой задаче