-
Notifications
You must be signed in to change notification settings - Fork 714
Show location of difference when comparing two strings #907
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
Comments
Did the unified diff idea get implemented? I looked in the related PR and documentation, but didn't see anything. |
No, but we are experimenting with it as we speak. See #2050 |
Thanks! I'll keep an eye on it. |
This issue has been marked as closed 2 years ago, but I notice that the implementation that is being used now seems to be
Except for me it seems to give only 3 or 4 characters, and those can be nearly impossible to find in a 4000 line yaml file which may have repeating patterns. Is there still not better option that gives more context? Whether that be:
|
In #2307, we improved the comparison a lot. This will be released as part of version 8 (ETA January). |
When using
string1.Should().Be(string2)
, if the strings differ it can be awkward to work out where the difference is for large string. E.g. if you're checking that building some json/xml/whatever-long-text works correctly.Click for example test output for xml text
At the moment, I'm copy & pasting from the test output into a diff tool so I can find where the difference is.
It would be great if the assert message also included a hint to where to the first difference.
Some ideas that I'd find handy (any of these could go after or before the current message showing the full actual vs expected text)
The specific details of how to show what the differences are (or at least the first difference) aren't very important, anything that helps speed up tracking down the differences would be 👍
The text was updated successfully, but these errors were encountered: