aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--lib/test/unit/assertions.rb14
2 files changed, 10 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index ebcd95c46b..09a75c5990 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Wed Apr 17 11:38:37 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * 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@ruby-lang.org>
* thread.c (sleep_timeval): get rid of overflow on Windows where
diff --git a/lib/test/unit/assertions.rb b/lib/test/unit/assertions.rb
index 984d5be726..b532146051 100644
--- a/lib/test/unit/assertions.rb
+++ b/lib/test/unit/assertions.rb
@@ -12,10 +12,8 @@ module Test
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
#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