tester icon indicating copy to clipboard operation
tester copied to clipboard

Assert::match does not match valid regex

Open PunchyRascal opened this issue 8 years ago • 2 comments

  • bug report? yes/no
  • feature request? yes/no
  • version: v1.7.1

Description

Until you realize, that your regex pattern cannot be delimited with /, the function does not work properly.

Steps To Reproduce

fails: Assert::match('/^foo$/', 'foo'); passes: Assert::match('#^foo$#', 'foo');

Perhaps it would be better to avoid this magic behavior (there is no indication you have done anything wrong) and add an extra assert for those tester expressions (with appropriate name) and keep this only for regular expressions, to avoid confusion. Or vice versa.

PunchyRascal avatar Feb 07 '17 10:02 PunchyRascal

Maybe add Assert::matchRE() and Assert::outputMatchRE()?

milo avatar Aug 13 '17 20:08 milo

Yeah, sure.

Sorry for the delay, I am now browsing through all my open issues, must have missed it back then

PunchyRascal avatar Jun 15 '18 12:06 PunchyRascal