Skip to content

Better output for strings #23

@Tarmil

Description

@Tarmil

The output for different strings just prints the two strings on separate lines. This is fine for short strings, but for longer ones, especially multiline, it can be difficult to find where exactly the difference is. We could take inspiration from other assertion libraries that indicate at which character position the strings begin to differ, and only print the section of the string around that position.

Hint for the person who wants to take up this issue: I think the best way to go would be to add a case String of x1: string * x2: string to the type Diff. This case would be used in Differ.diffWith instead of simpleEquality (which returns a Diff.Value). Its display format would then be applied in DiffPrinter.toStreamImpl.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions