-
Notifications
You must be signed in to change notification settings - Fork 733
Improve failure message for string assertions when checking for equality #2307
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
Improve failure message for string assertions when checking for equality #2307
Conversation
Qodana for .NET5 new problems were found
💡 Qodana analysis was run in the pull request mode: only the changed files were checked View the detailed Qodana reportTo be able to view the detailed Qodana report, you can either:
To get - name: 'Qodana Scan'
uses: JetBrains/[email protected]
with:
upload-result: trueContact Qodana teamContact us at [email protected]
|
dennisdoomen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a pretty impressive improvement. I had some quite some issues understanding the algorithm, so I've gone through a pretty thorough review.
…lityStrategy` class
Tests/FluentAssertions.Specs/Primitives/StringAssertionSpecs.Be.cs
Outdated
Show resolved
Hide resolved
@dennisdoomen. Thanks for the extensive review. It's really appreciated! I implemented your requested changes and answered your questions. I hope I didn't overlook anything :-) |
jnyrup
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really great!
I haven't gone through all the relational operators to check if they are correct.
I'll try to run mutation tests on StringEqualityStrategy.cs sometime this week to help verifying this. If you want to try mutation tests before I get to it, there are some pointers in #1068 and jnyrup#6
Shall we add that to our pipeline? |
That's my plan. |
I also use Stryker in my project and just ran it against fluentassertions Mutation Testing Summary
I will add tests for the 3 survived mutants together with the changes for your review :-) |
|
@jnyrup Mutation Testing Summary
|
dennisdoomen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I said before, great work. The new comments and improved naming really helps (even though it is still quite an algorithm).
Since we've tried to get rid of words like when and should in test names and focus more on the fact that such a test covers, I've suggested some improvements. Up to you if you want to include them now. Otherwise, I'll do it at a later point.
When asserting that two strings are equal, and one of the strings is longer than 8 characters or contains a NewLine, instead of simply stating at which index the first difference occurs, this difference is made visible using arrows, e.g.
throws with message
For multi-line strings, instead of only providing information about the index, the failure message also contains the line and column information, e.g.
…but they differ on line 5 and column 1 (index 93):For short single-line strings the behaviour remains unchanged!
This closes #2050.
IMPORTANT
./build.sh --target spellcheckor.\build.ps1 --target spellcheckbefore pushing and check the good outcome