summaryrefslogtreecommitdiff
path: root/test/ruby/test_exception.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-09-02 16:47:12 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-09-02 16:47:12 +0900
commit8b2e1ca10ecf92ad402decd6b1eab586eded0ddb (patch)
treeb3b25f9644a49971f0c4d6010d1695fe0f08750c /test/ruby/test_exception.rb
parent8e38d4c78c1a9b45f604963f85995e9a817ee72c (diff)
Do not clear backtrace in Exception#exception
[Bug #15558]
Diffstat (limited to 'test/ruby/test_exception.rb')
-rw-r--r--test/ruby/test_exception.rb12
1 files changed, 12 insertions, 0 deletions
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