1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
ko1 2013-12-13 04:31:06 +00:00
parent 4547d773c2
commit 0aed7c6874
6 changed files with 89 additions and 1 deletions

View file

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