+ assert_match now returns the MatchData on success. (Nakilon)
[git-p4: depot-paths = "//src/minitest/dev/": change = 13421]
This commit is contained in:
parent
8a131bfa29
commit
ed224bc998
|
@ -293,6 +293,8 @@ module Minitest
|
|||
assert_respond_to matcher, :"=~"
|
||||
matcher = Regexp.new Regexp.escape matcher if String === matcher
|
||||
assert matcher =~ obj, msg
|
||||
|
||||
Regexp.last_match
|
||||
end
|
||||
|
||||
##
|
||||
|
|
|
@ -484,7 +484,10 @@ class TestMinitestAssertions < Minitest::Test
|
|||
|
||||
def test_assert_match
|
||||
@assertion_count = 2
|
||||
@tc.assert_match(/\w+/, "blah blah blah")
|
||||
m = @tc.assert_match(/\w+/, "blah blah blah")
|
||||
|
||||
assert_kind_of MatchData, m
|
||||
assert_equal "blah", m[0]
|
||||
end
|
||||
|
||||
def test_assert_match_matchee_to_str
|
||||
|
|
|
@ -505,7 +505,7 @@ describe Minitest::Spec do
|
|||
it "needs to verify regexp matches" do
|
||||
@assertion_count += 3 # must_match is 2 assertions
|
||||
|
||||
assert_success _("blah").must_match(/\w+/)
|
||||
assert_kind_of MatchData, _("blah").must_match(/\w+/)
|
||||
|
||||
assert_triggered "Expected /\\d+/ to match \"blah\"." do
|
||||
_("blah").must_match(/\d+/)
|
||||
|
|
Loading…
Reference in New Issue