Repository navigation
Better diffs #112
Description
Activity
@dylanhitt What do you think about printing the diff as a table?
For each test a table:
Expected Operator Result 1 Equal 3 True Equal False Hello contained in Hey World As a summary:
Or as complete summary like this (maybe a readable like a sentence with the
Operationcolumn):Test Expected Operation Result it should be equal 1 does not equal 3 it is true True does not equal False it contains hello Hello is not contained in Hey World Some more ideas:
- If a text is too long it will be cropped, i.e. after 100 characters
- If a text is more than, i.e. 10 lines, it will be cropped
- The operator is filled defined in the corresponding Matcher
The table would have the benefit that it is always consistent. The disadvantage is that it is not as verbose and detailed as it is currently.
Imho it could be one of many output formats for the result and will be added along the current one.Reacted by Dylan HittLet's start with that. I was thinking about how to deal with large text files. A bit of a cop out but it would help, we could scan the string until we reach the first point where there is a difference and pinpoint that spot something like
hello w^rld. Of course we could print something cleaner than this example. But i'd say switching to table would be best.I like the second table a lot actually. I didn't quite pick up that could be read like a sentence when I first read it. I need to stop skimming text 🙃
Reacted by Simon BäumerYes, a good diff library would be very cool. But I think we can't achieve a good (human) readability and displaying the difference in the results.
For example what do we do if the diff is too big?You don't necessarily have to print the whole string just the context and the area around it that is different, maybe include the line number where it is first different. I'm not really proposing we do this now, it was mainly just spitting out ideas.
Reacted by Simon Bäumer
It would be nice to print better diffs between the expected and actual result