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

ruby-changes:26324

From: nobu <ko1@a...>
Date: Fri, 14 Dec 2012 14:59:34 +0900 (JST)
Subject: [ruby-changes:26324] nobu:r38375 (trunk): envutil.rb: using caller_locations

nobu	2012-12-14 14:59:17 +0900 (Fri, 14 Dec 2012)

  New Revision: 38375

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

  Log:
    envutil.rb: using caller_locations
    
    * test/ruby/envutil.rb (Test::Unit::Assertions#assert_separately):
      take file and line by using caller_locations if not given.

  Modified files:
    trunk/ChangeLog
    trunk/test/ruby/envutil.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 38374)
+++ ChangeLog	(revision 38375)
@@ -1,4 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
-Fri Dec 14 14:58:37 2012  Nobuyoshi Nakada  <nobu@r...>
+Fri Dec 14 14:59:14 2012  Nobuyoshi Nakada  <nobu@r...>
+
+	* test/ruby/envutil.rb (Test::Unit::Assertions#assert_separately):
+	  take file and line by using caller_locations if not given.
 
 	* test/ruby/envutil.rb (Test::Unit::Assertions#assert_separately):
 	  count assertions in separated tests.
Index: test/ruby/envutil.rb
===================================================================
--- test/ruby/envutil.rb	(revision 38374)
+++ test/ruby/envutil.rb	(revision 38375)
@@ -193,8 +193,12 @@ module Test https://github.com/ruby/ruby/blob/trunk/test/ruby/envutil.rb#L193
         assert(status.success?, m)
       end
 
-      def assert_separately(args, file, line, src)
-        opt = {}
+      def assert_separately(args, file = nil, line = nil, src, **opt)
+        unless file and line
+          loc, = caller_locations(1,1)
+          file ||= loc.path
+          line ||= loc.lineno
+        end
         src = <<eom
   require 'test/unit';include Test::Unit::Assertions;begin;#{src}
   ensure

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

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