ruby-changes:23521
From: naruse <ko1@a...>
Date: Tue, 8 May 2012 02:50:09 +0900 (JST)
Subject: [ruby-changes:23521] naruse:r35572 (trunk): * lib/minitest/unit.rb (assert_match): refix of r35563.
naruse 2012-05-08 02:49:53 +0900 (Tue, 08 May 2012) New Revision: 35572 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=35572 Log: * lib/minitest/unit.rb (assert_match): refix of r35563. r35563 breaks the intention of the original change. https://github.com/seattlerb/minitest/commit/68858105b2eb11c85105ffac5f32b662c59397f3 * lib/minitest/unit.rb (refute_match): ditto. Modified files: trunk/ChangeLog trunk/lib/minitest/unit.rb trunk/test/minitest/test_minitest_unit.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 35571) +++ ChangeLog (revision 35572) @@ -1,3 +1,10 @@ +Tue May 8 02:34:26 2012 NARUSE, Yui <naruse@r...> + + * lib/minitest/unit.rb (assert_match): refix of r35563. + r35563 breaks the intention of the original change. + https://github.com/seattlerb/minitest/commit/68858105b2eb11c85105ffac5f32b662c59397f3 + * lib/minitest/unit.rb (refute_match): ditto. + Mon May 7 21:19:17 2012 NARUSE, Yui <naruse@r...> * ext/json: Merge JSON 1.7.1. Index: lib/minitest/unit.rb =================================================================== --- lib/minitest/unit.rb (revision 35571) +++ lib/minitest/unit.rb (revision 35572) @@ -282,7 +282,7 @@ def assert_match matcher, obj, msg = nil msg = message(msg) { "Expected #{mu_pp matcher} to match #{mu_pp obj}" } assert_respond_to obj, :"=~" - matcher = Regexp.new Regexp.escape matcher if String === matcher and String === obj + matcher = Regexp.new Regexp.escape matcher if String === matcher and obj.respond_to?(:to_str) assert matcher =~ obj, msg end @@ -583,7 +583,7 @@ def refute_match matcher, obj, msg = nil msg = message(msg) {"Expected #{mu_pp matcher} to not match #{mu_pp obj}"} assert_respond_to obj, :"=~" - matcher = Regexp.new Regexp.escape matcher if String === matcher and String === obj + matcher = Regexp.new Regexp.escape matcher if String === matcher and obj.respond_to?(:to_str) refute matcher =~ obj, msg end Index: test/minitest/test_minitest_unit.rb =================================================================== --- test/minitest/test_minitest_unit.rb (revision 35571) +++ test/minitest/test_minitest_unit.rb (revision 35572) @@ -952,6 +952,15 @@ @tc.assert_match "blah", obj end + def test_assert_match_matchee_match + @assertion_count = 2 + + obj = Object.new + def obj.=~(o); true end + + @tc.assert_match "blah", obj + end + def test_assert_match_object_triggered @assertion_count = 2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/