ruby-changes:37381
From: nobu <ko1@a...>
Date: Sat, 31 Jan 2015 22:57:54 +0900 (JST)
Subject: [ruby-changes:37381] nobu:r49462 (trunk): test_backtrace.rb: add test
nobu 2015-01-31 22:57:46 +0900 (Sat, 31 Jan 2015) New Revision: 49462 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=49462 Log: test_backtrace.rb: add test * test/ruby/test_backtrace.rb (test_caller_locations_lineno): test for Thread::Backtrace::Location#lineno. Modified files: trunk/test/ruby/test_backtrace.rb Index: test/ruby/test_backtrace.rb =================================================================== --- test/ruby/test_backtrace.rb (revision 49461) +++ test/ruby/test_backtrace.rb (revision 49462) @@ -185,6 +185,16 @@ class TestBacktrace < Test::Unit::TestCa https://github.com/ruby/ruby/blob/trunk/test/ruby/test_backtrace.rb#L185 end end + def test_caller_locations_lineno + loc, = caller_locations(0, 1) + assert_equal(__LINE__-1, loc.lineno) + Tempfile.create(%w"caller_locations .rb") do |f| + f.puts "caller_locations(0, 1)[0].tap {|loc| puts loc.lineno}" + f.close + assert_in_out_err(["-C", *File.split(f.path)], "", ["1"]) + 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/