Skip to content

[Feature]: Handle multiline string diffs more cleanly #4511

@Rekkonnect

Description

@Rekkonnect

Problem Statement

The current string diff is great for single-line strings, but when the difference is near newlines, it breaks really bad. For my current project which involves multiline strings as code, it's very hard to make much out of most of the assertion failure text.

Proposed Solution

The best way to represent that would be to show a line-based diff. For example, consider Roslyn's diff implementation, which cleanly shows the differences in the strings, since almost always those are multiline.

My proposal is to show the surrounding 2 lines up and down of each changed line segment, and replace the current "expected ... but found ..." text which is completely useless once the diff is shown.

Alternatives Considered

No response

Feature Category

Assertions

How important is this feature to you?

Important - significantly impacts my workflow

Additional Context

TUnit v1.9.64 and v1.12.3

Contribution

  • I'm willing to submit a pull request for this feature

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions