mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
test_backtrace.rb: add tests
* test/ruby/test_backtrace.rb (test_caller_locations_base_label): test for Thread::Backtrace::Location#base_label. * test/ruby/test_backtrace.rb (test_caller_locations_label): test for Thread::Backtrace::Location#label. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
38a37ed8f2
commit
5146f5abe9
1 changed files with 22 additions and 0 deletions
|
@ -195,6 +195,28 @@ class TestBacktrace < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
def test_caller_locations_base_label
|
||||
assert_equal("#{__method__}", caller_locations(0, 1)[0].base_label)
|
||||
loc, = tap {|loc| break caller_locations(0, 1)}
|
||||
assert_equal("#{__method__}", loc.base_label)
|
||||
begin
|
||||
raise
|
||||
rescue
|
||||
assert_equal("#{__method__}", caller_locations(0, 1)[0].base_label)
|
||||
end
|
||||
end
|
||||
|
||||
def test_caller_locations_label
|
||||
assert_equal("#{__method__}", caller_locations(0, 1)[0].label)
|
||||
loc, = tap {|loc| break caller_locations(0, 1)}
|
||||
assert_equal("block in #{__method__}", loc.label)
|
||||
begin
|
||||
raise
|
||||
rescue
|
||||
assert_equal("rescue in #{__method__}", caller_locations(0, 1)[0].label)
|
||||
end
|
||||
end
|
||||
|
||||
def th_rec q, n=10
|
||||
if n > 1
|
||||
th_rec q, n-1
|
||||
|
|
Loading…
Reference in a new issue