ruby-changes:37385
From: nobu <ko1@a...>
Date: Sun, 1 Feb 2015 18:40:18 +0900 (JST)
Subject: [ruby-changes:37385] nobu:r49466 (trunk): test_backtrace.rb: add tests
nobu 2015-02-01 18:40:09 +0900 (Sun, 01 Feb 2015) New Revision: 49466 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=49466 Log: 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. Modified files: trunk/test/ruby/test_backtrace.rb Index: test/ruby/test_backtrace.rb =================================================================== --- test/ruby/test_backtrace.rb (revision 49465) +++ test/ruby/test_backtrace.rb (revision 49466) @@ -195,6 +195,28 @@ class TestBacktrace < Test::Unit::TestCa https://github.com/ruby/ruby/blob/trunk/test/ruby/test_backtrace.rb#L195 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/