Do not clear backtrace in Exception#exception

[Bug #15558]
This commit is contained in:
Nobuyoshi Nakada 2019-09-02 16:47:12 +09:00
parent 8e38d4c78c
commit 8b2e1ca10e
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60
2 changed files with 14 additions and 2 deletions

View file

@ -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