Skip to content

Better diffs #112

Description

@SimonBaeumer

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

Activity

  1. modified the milestones: v2.1.0, v2.2.0, v2.0.0 on Feb 11, 2020
  2. removed this from the v2.0.0 milestone on Feb 22, 2020
  3. SimonBaeumer commented on Oct 18, 2020

    @SimonBaeumer
    MemberAuthor

    @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.

  4. dylanhitt commented on Oct 19, 2020

    @dylanhitt
    Member

    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 🙃

  5. SimonBaeumer commented on Oct 23, 2020

    @SimonBaeumer
    MemberAuthor

    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?

  6. dylanhitt commented on Oct 23, 2020

    @dylanhitt
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions