summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-12-13 04:31:06 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-12-13 04:31:06 +0000
commit0aed7c6874ba75f1a85899d0ed0ea07b24a9f3ef (patch)
tree71350c2b48c1b2defd672ed3f672d130a7e5ebc0 /test/ruby
parent4547d773c2ea02864df5658a99d18718626e902d (diff)
* error.c: add Exception#backtrace_locations.
Now, there are no setter and independent from Exception#backtrace. [Feature #8960] * eval.c (setup_exception): set backtrace locations for `bt_location' special attribute. * vm_backtrace.c (rb_backtrace_to_location_ary): added. * internal.h: ditto. * test/ruby/test_backtrace.rb: add a test for Exception#backtrace_locations. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44170 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_backtrace.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/ruby/test_backtrace.rb b/test/ruby/test_backtrace.rb
index 91dec4a943..aded544dcf 100644
--- a/test/ruby/test_backtrace.rb
+++ b/test/ruby/test_backtrace.rb
@@ -14,6 +14,36 @@ class TestBacktrace < Test::Unit::TestCase
assert_match(/.+:\d+:.+/, bt[0])
end
+ def helper_test_exception_backtrace_locations
+ raise
+ end
+
+ def test_exception_backtrace_locations
+ bt = Fiber.new{
+ begin
+ raise
+ rescue => e
+ e.backtrace_locations
+ end
+ }.resume
+ assert_equal(1, bt.size)
+ assert_match(/.+:\d+:.+/, bt[0].to_s)
+
+ bt = Fiber.new{
+ begin
+ begin
+ helper_test_exception_backtrace_locations
+ rescue
+ raise
+ end
+ rescue => e
+ e.backtrace_locations
+ end
+ }.resume
+ assert_equal(2, bt.size)
+ assert_match(/helper_test_exception_backtrace_locations/, bt[0].to_s)
+ end
+
def test_caller_lev
cs = []
Fiber.new{