ruby-changes:17548
From: ryan <ko1@a...>
Date: Fri, 22 Oct 2010 06:18:26 +0900 (JST)
Subject: [ruby-changes:17548] Ruby:r29553 (trunk): Cleaned up clevar in test/unit's override of assert
ryan 2010-10-22 06:15:06 +0900 (Fri, 22 Oct 2010) New Revision: 29553 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=29553 Log: Cleaned up clevar in test/unit's override of assert Modified files: trunk/lib/test/unit/assertions.rb Index: lib/test/unit/assertions.rb =================================================================== --- lib/test/unit/assertions.rb (revision 29552) +++ lib/test/unit/assertions.rb (revision 29553) @@ -10,10 +10,12 @@ 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/