-
Notifications
You must be signed in to change notification settings - Fork 137
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
Possible assertEquals output enhancement #83
Comments
I have something along those lines in mind for comparing strings. I was also thinking about a full diff but abbreviatting the output is also an interesting path. For lists, the git version of LuaUnit (unreleased at the moment) does some diff analysis of the list to simplify the analysis. See https://github.com/bluebird75/luaunit/blob/master/test/ref/some_lists_comparisons.txt . I'll have a look a JUnit for more inspiration. Do you have any real world example of comparison implying big lists and/or big strings ? Such data would be really useful. |
yes, i just started to use it to test a simple text parser. Some example data here: In my case, if the test fails, it is usually just one node missing or nested on a different level. Or a space missing in one of the strings etc. |
We could possibly re-use some code/logic from the "list" comparison ( Regards, NiteHawk |
Why not... The most challenging part is to make the output readable, especially in case of multi-line strings. The output should probably be different for single line comparison and multi-line strings. I was thinking about using the unified diff syntax. Example for one line comparison :
Example for multi-line comparison
I have in mind for a long time to use a diff library to perform really intelligent string and lists comparisons. See : https://github.com/paulgb/simplediff/tree/master/lua |
When comparing very long strings where only a small part of it is different it is quite difficult to see in the output what the difference is.
FYI JUnit does it this way (note the three dots and braces):
Something similar would be very useful when comparing big tables.
The text was updated successfully, but these errors were encountered: