assertions.rb: remove UNASSIGNED
* lib/test/unit/assertions.rb (Test::Unit::Assertions#assert): UNASSIGNED is not a valid message. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40330 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9e39bc1a08
commit
9efcd10371
@ -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>
|
Wed Apr 17 10:58:18 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* thread.c (sleep_timeval): get rid of overflow on Windows where
|
* thread.c (sleep_timeval): get rid of overflow on Windows where
|
||||||
|
@ -12,10 +12,8 @@ module Test
|
|||||||
|
|
||||||
MINI_DIR = File.join(File.dirname(File.dirname(File.expand_path(__FILE__))), "minitest") #:nodoc:
|
MINI_DIR = File.join(File.dirname(File.dirname(File.expand_path(__FILE__))), "minitest") #:nodoc:
|
||||||
|
|
||||||
UNASSIGNED = Object.new # :nodoc:
|
|
||||||
|
|
||||||
# :call-seq:
|
# :call-seq:
|
||||||
# assert( test, failure_message = UNASSIGNED )
|
# assert(test, [failure_message])
|
||||||
#
|
#
|
||||||
#Tests if +test+ is true.
|
#Tests if +test+ is true.
|
||||||
#
|
#
|
||||||
@ -26,15 +24,13 @@ module Test
|
|||||||
#If no +msg+ is given, a default message will be used.
|
#If no +msg+ is given, a default message will be used.
|
||||||
#
|
#
|
||||||
# assert(false, "This was expected to be true")
|
# assert(false, "This was expected to be true")
|
||||||
def assert(test, msg = UNASSIGNED)
|
def assert(test, *msgs)
|
||||||
case msg
|
case msg = msgs.first
|
||||||
when UNASSIGNED
|
|
||||||
msg = nil
|
|
||||||
when String, Proc
|
when String, Proc
|
||||||
else
|
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
|
raise ArgumentError, "assertion message must be String or Proc, but #{msg.class} was given.", bt
|
||||||
end
|
end unless msgs.empty?
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user