[前][次][番号順一覧][スレッド一覧]

ruby-changes:37379

From: nobu <ko1@a...>
Date: Sat, 31 Jan 2015 22:10:23 +0900 (JST)
Subject: [ruby-changes:37379] nobu:r49460 (trunk): test_backtrace.rb: add test

nobu	2015-01-31 22:10:05 +0900 (Sat, 31 Jan 2015)

  New Revision: 49460

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=49460

  Log:
    test_backtrace.rb: add test
    
    * test/ruby/test_backtrace.rb (test_caller_locations_path): test
      for Thread::Backtrace::Location#path and #absolute_path.

  Modified files:
    trunk/test/ruby/test_backtrace.rb
Index: test/ruby/test_backtrace.rb
===================================================================
--- test/ruby/test_backtrace.rb	(revision 49459)
+++ test/ruby/test_backtrace.rb	(revision 49460)
@@ -1,5 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/test/ruby/test_backtrace.rb#L1
 require 'test/unit'
 require 'thread'
+require 'tempfile'
 
 class TestBacktrace < Test::Unit::TestCase
   def test_exception
@@ -163,6 +164,18 @@ class TestBacktrace < Test::Unit::TestCa https://github.com/ruby/ruby/blob/trunk/test/ruby/test_backtrace.rb#L164
     }
   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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]