Improved error message for one assert function #333
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What's the problem?
If the user makes a mistake in the
assert_error_msg_content_equals
:where:
then the following error will be returned:
The user thinks that a comparison is being made between
foo:1: bar
andbad
. He notices this error and at the same time can write the following:Now he will get the following error:
It seems that the function doesn't work cause these strings are equal. In fact, a comparison will be performed between
foo:1: bar
(excepted) andbar
strings (becausefoo:1:
will be dropped from the error message by regex).The next use of the function will be correct:
What's the solution?
It is necessary to save the result of conversion after the
gsub
. So this way the user will see the actual strings that are being compared:Close #316