diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-01-31 13:10:05 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-01-31 13:10:05 +0000 |
commit | dc0991c8d8e9d9d6362475d0bc719de54af8b5a0 (patch) | |
tree | 87bb78f7ad6caa4ea32e2ef389a48a3506527d28 | |
parent | 665ee6cd0356f09facdb5b218b5d1cf056d85811 (diff) | |
download | ruby-dc0991c8d8e9d9d6362475d0bc719de54af8b5a0.tar.gz |
test_backtrace.rb: add test
* test/ruby/test_backtrace.rb (test_caller_locations_path): test
for Thread::Backtrace::Location#path and #absolute_path.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49460 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | test/ruby/test_backtrace.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/ruby/test_backtrace.rb b/test/ruby/test_backtrace.rb index ad1ea80d31..b9fb8a19d1 100644 --- a/test/ruby/test_backtrace.rb +++ b/test/ruby/test_backtrace.rb @@ -1,5 +1,6 @@ require 'test/unit' require 'thread' +require 'tempfile' class TestBacktrace < Test::Unit::TestCase def test_exception @@ -163,6 +164,18 @@ class TestBacktrace < Test::Unit::TestCase } end + def test_caller_locations_path + loc, = caller_locations(0, 1) + assert_equal(__FILE__, loc.path) + assert_equal(__FILE__, loc.absolute_path) + Tempfile.create(%w"caller_locations .rb") do |f| + f.puts "caller_locations(0, 1)[0].tap {|loc| puts loc.path, loc.absolute_path}" + f.close + path = f.path + assert_in_out_err(["-C", *File.split(path)], "", [File.basename(f.path), File.realpath(f.path)]) + end + end + def th_rec q, n=10 if n > 1 th_rec q, n-1 |