-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
StringMatchesFormatDescription Does Not Handle Escaped % Properly #2907
Comments
I would consider (separate) pull requests that fix |
I think I could take a stab at this. I'll see what I can come up with... |
mkasberg
added a commit
to mkasberg/phpunit
that referenced
this issue
Dec 9, 2017
For example, the format '%%d' should match the string literal '%d'. We achieve this by using negative lookbehind (http://php.net/manual/en/regexp.reference.assertions.php) when constructing the regex pattern that we will match against.
mkasberg
added a commit
to mkasberg/phpunit
that referenced
this issue
Dec 9, 2017
For example, the format '%%d' should match the string literal '%d'. We achieve this by using negative lookbehind (http://php.net/manual/en/regexp.reference.assertions.php) when constructing the regex pattern that we will match against.
This was referenced Dec 10, 2017
sebastianbergmann
pushed a commit
that referenced
this issue
Aug 31, 2018
sebastianbergmann
pushed a commit
that referenced
this issue
Aug 31, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I would expect the following test case to pass because the format string
'%%'
should produce a literal'%'
(sprintf). But it fails in PHPUnit 6.5.3.StringMatchesFormatDescriptionTest.php
Sample Output:
I skimmed the source code for StringMatchesFormatDescription.php, and it is perhaps worth noting that we also seem to be missing a few other descriptors which are supported by PHP. For example,
%b
,%E
, and%g
. (Should we expect PHPUnit to support all of these?)None of these are major bugs since it's certainly possible to work around them, but it might be nice to have better support for format string matching.
The text was updated successfully, but these errors were encountered: