diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-01-31 13:57:46 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-01-31 13:57:46 +0000 |
commit | 8f02de20502c491a8df636e1bce614ce1e8cd1c5 (patch) | |
tree | 5ef377b126e5993322dbb905bc396169cc17feb4 /test | |
parent | 4c1afa78aa992df91acd5cdedfd1ccf3b33352f0 (diff) | |
download | ruby-8f02de20502c491a8df636e1bce614ce1e8cd1c5.tar.gz |
test_backtrace.rb: add test
* test/ruby/test_backtrace.rb (test_caller_locations_lineno): test
for Thread::Backtrace::Location#lineno.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49462 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_backtrace.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_backtrace.rb b/test/ruby/test_backtrace.rb index 9116e0a32a..f52f80af59 100644 --- a/test/ruby/test_backtrace.rb +++ b/test/ruby/test_backtrace.rb @@ -185,6 +185,16 @@ class TestBacktrace < Test::Unit::TestCase 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 |