Skip to content

Request for cr_assert_stdout_eq_str and cr_assert_stderr_eq_str to print the actual file contents on failure #556

@CamJN

Description

@CamJN

Currently when cr_assert_stdout_eq_str fails the assertion, it prints a message like: The file contents of __stdoutp does not match the string "foo".

It would be substantially more useful to see both the expected and actual strings, in order to reason about what went wrong.

Something like the following would be awesome:

The file contents of __stdoutp does not match the given string:
- Expected:
This is an example of a multi-line expected string
it is both long and awkward to format, but that's life sometimes
+ Actual:
This was the actual output of the test
it does not match the expected string at all, oops!

I get that it would require reworking cr_file_match_str to stash the file contents somewhere or something and therefore isn't easy, but it would be really great if it could happen.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions