Skip to content
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

Better diffs #112

Open
SimonBaeumer opened this issue Feb 11, 2020 · 4 comments
Open

Better diffs #112

SimonBaeumer opened this issue Feb 11, 2020 · 4 comments

Comments

@SimonBaeumer
Copy link
Member

It would be nice to print better diffs between the expected and actual result

@SimonBaeumer SimonBaeumer modified the milestones: v2.1.0, v2.2.0, v2.0.0 Feb 11, 2020
@SimonBaeumer SimonBaeumer removed this from the v2.0.0 milestone Feb 22, 2020
@dylanhitt dylanhitt mentioned this issue Oct 18, 2020
4 tasks
@SimonBaeumer
Copy link
Member Author

SimonBaeumer commented Oct 18, 2020

@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 Operation column):

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.

@dylanhitt
Copy link
Member

dylanhitt commented Oct 19, 2020

Let'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 🙃

@SimonBaeumer
Copy link
Member Author

Yes, 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?

@dylanhitt
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants