Actions
Bug #770
closedassert_match should escape string argument
Description
=begin
String expectation for assert_match should be matched literally, not as a regexp.
test/unit: assert_match '.', 'a' #=> fails
minitest: assert_match '.', 'a' #=> passes
Index: lib/minitest/unit.rb¶
--- lib/minitest/unit.rb (revision 20290)
+++ lib/minitest/unit.rb (working copy)
@@ -118,7 +118,7 @@
def assert_match exp, act, msg = nil
msg = message(msg) { "Expected #{mu_pp(act)} to match #{mu_pp(exp)}" }
assert_respond_to act, :"=~"
-
(exp = /#{exp}/) if String === exp && String === act
-
end(exp = /#{Regexp.escape(exp)}/) if String === exp && String === act assert act =~ exp, msg
=end
Updated by yugui (Yuki Sonoda) almost 16 years ago
- Status changed from Open to Assigned
- Priority changed from Normal to 5
- Target version set to 1.9.1 Release Candidate
=begin
Right.
Matz, ko1, nakada, akr and yugui thought this patch should be merged.
=end
Updated by zenspider (Ryan Davis) almost 16 years ago
- Status changed from Assigned to Closed
=begin
fixed. thanks.
=end
Actions
Like0
Like0Like0