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

ruby-changes:28278

From: nobu <ko1@a...>
Date: Wed, 17 Apr 2013 11:40:00 +0900 (JST)
Subject: [ruby-changes:28278] nobu:r40330 (trunk): assertions.rb: remove UNASSIGNED

nobu	2013-04-17 11:39:02 +0900 (Wed, 17 Apr 2013)

  New Revision: 40330

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

  Log:
    assertions.rb: remove UNASSIGNED
    
    * lib/test/unit/assertions.rb (Test::Unit::Assertions#assert):
      UNASSIGNED is not a valid message.

  Modified files:
    trunk/ChangeLog
    trunk/lib/test/unit/assertions.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 40329)
+++ ChangeLog	(revision 40330)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Apr 17 11:38:37 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* lib/test/unit/assertions.rb (Test::Unit::Assertions#assert):
+	  UNASSIGNED is not a valid message.
+
 Wed Apr 17 10:58:18 2013  Nobuyoshi Nakada  <nobu@r...>
 
 	* thread.c (sleep_timeval): get rid of overflow on Windows where
Index: lib/test/unit/assertions.rb
===================================================================
--- lib/test/unit/assertions.rb	(revision 40329)
+++ lib/test/unit/assertions.rb	(revision 40330)
@@ -12,10 +12,8 @@ module Test https://github.com/ruby/ruby/blob/trunk/lib/test/unit/assertions.rb#L12
 
       MINI_DIR = File.join(File.dirname(File.dirname(File.expand_path(__FILE__))), "minitest") #:nodoc:
 
-      UNASSIGNED = Object.new # :nodoc:
-
       # :call-seq:
-      #   assert( test, failure_message = UNASSIGNED )
+      #   assert(test, [failure_message])
       #
       #Tests if +test+ is true.
       #
@@ -26,15 +24,13 @@ module Test https://github.com/ruby/ruby/blob/trunk/lib/test/unit/assertions.rb#L24
       #If no +msg+ is given, a default message will be used.
       #
       #    assert(false, "This was expected to be true")
-      def assert(test, msg = UNASSIGNED)
-        case msg
-        when UNASSIGNED
-          msg = nil
+      def assert(test, *msgs)
+        case msg = msgs.first
         when String, Proc
         else
-          bt = caller.reject { |s| s.rindex(MINI_DIR, 0) }
+          bt = caller.reject { |s| s.start_with?(MINI_DIR) }
           raise ArgumentError, "assertion message must be String or Proc, but #{msg.class} was given.", bt
-        end
+        end unless msgs.empty?
         super
       end
 

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

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