Skip to content

Improvements to the assertion failed error message #36392

Closed
@antoyo

Description

@antoyo

Hello.
It would be nice to show the differences between the left and right value more visually, with a diff-like format and/or with colors.
For instance, with the following code:

assert_eq!("my very very very very very very very very long sentence",
    "my very very very very very very very very long snetence");

we get:

thread 'test' panicked at 'assertion failed: `(left == right)` (left: `"my very very very very very very very very long sentence"`, right: `"my very very very very very very very very long snetence"`), tests/lib.rs:10

It is not easy to spot immediately the difference between the expected and the actual values.
Showing this with colors would greatly reduce the amount of time needed to spot the difference.
Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions