mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/minitest/unit.rb (assert_match): refix of r35563.
r35563 breaks the intention of the original change.
68858105b2
* lib/minitest/unit.rb (refute_match): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35572 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
40f1939614
commit
49331ddec7
3 changed files with 18 additions and 2 deletions
|
@ -1,3 +1,10 @@
|
|||
Tue May 8 02:34:26 2012 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* 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@ruby-lang.org>
|
||||
|
||||
* ext/json: Merge JSON 1.7.1.
|
||||
|
|
|
@ -282,7 +282,7 @@ module MiniTest
|
|||
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 @@ module MiniTest
|
|||
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
|
||||
|
||||
|
|
|
@ -952,6 +952,15 @@ class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase
|
|||
@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
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue