summaryrefslogtreecommitdiff
path: root/lib/test/unit
diff options
context:
space:
mode:
authorryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-10-21 21:15:06 +0000
committerryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-10-21 21:15:06 +0000
commitb3ee43bb6ea50fd45e7e84c5d8e84452b9fc93c8 (patch)
treece5860e138967ddbaf39b8741aa8da39bce49922 /lib/test/unit
parentc400795c8cf9668fc11db369e42876974c20ec6f (diff)
Cleaned up clevar in test/unit's override of assert
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29553 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/test/unit')
-rw-r--r--lib/test/unit/assertions.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/test/unit/assertions.rb b/lib/test/unit/assertions.rb
index 6e4707fc25..ab3dd83aaa 100644
--- a/lib/test/unit/assertions.rb
+++ b/lib/test/unit/assertions.rb
@@ -10,10 +10,12 @@ module Test
obj.pretty_inspect.chomp
end
- def assert(test, msg = (nomsg = true; nil))
- unless nomsg or msg.instance_of?(String) or msg.instance_of?(Proc) or
- (bt = caller).first.rindex(MiniTest::MINI_DIR, 0)
- bt.delete_if {|s| s.rindex(MiniTest::MINI_DIR, 0)}
+ UNASSIGNED = Object.new # :nodoc:
+
+ def assert(test, msg = UNASSIGNED)
+ msg = nil if msg == UNASSIGNED
+ unless String === msg or Proc === msg then
+ bt = caller.reject { |s| s.rindex(MiniTest::MINI_DIR, 0) }
raise ArgumentError, "assertion message must be String or Proc, but #{msg.class} was given.", bt
end
super