-
Notifications
You must be signed in to change notification settings - Fork 379
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
equalTo
matcher should show a diff of the difference to make it possible to see where it is
#209
Comments
I just had the same idea this week. I'm writing an XML/HTML formatter, and I have a reasonably large HTML document of what I expect in a unit test. Using a similar approach as TDD, I set up the unit test before the formatter is fully complete, and I need to know which items the formatter needs work on. Currently I'm placing the expected document and a I don't know if a diff should occur with every use of In a perfect world this would also use something like Jansi to provide a color-coded diff, like VS Code, TortoiseGit, and even Eclipse does nowadays. |
Hi, I would like to work on this issue @nhojpatrick . |
I would probably find a heuristic to guess whether the caller would like a diff or not, e.g. something like if the expected string contains more than one Otherwise we're going to have to go through our millions of assertions and manually change some of them to |
I think it a great idea to use some heuristics to infer whether to diff the output or not, but It could be difficult to have a general standard. Maybe more discussions are required. |
If large texts are compared with
equalTo
, you just get both texts in full, and ultimately have to copy them out to text files manually and run a diff tool to figure out what the difference is. This is made worse because downstream tools reading the results don't produce diffs themselves. (To point the finger at one of the major suspects, IntelliJ IDEA shows diffs but only for tiny strings, even though for tiny strings you don't really need a diff to see the difference, but then doesn't show it for large strings, where you certainly can't see the difference without using diff.)I think it's reasonable for the matcher's description of the mismatch to include this sort of thing as the primary message, and maybe include the full messages only for further information.
The text was updated successfully, but these errors were encountered: