From 8b2e1ca10ecf92ad402decd6b1eab586eded0ddb Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Mon, 2 Sep 2019 16:47:12 +0900 Subject: Do not clear backtrace in Exception#exception [Bug #15558] --- test/ruby/test_exception.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_exception.rb b/test/ruby/test_exception.rb index 55f0d27c88..9de1b2d82c 100644 --- a/test/ruby/test_exception.rb +++ b/test/ruby/test_exception.rb @@ -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 -- cgit v1.2.3