Snaipe / Criterion

A cross-platform C and C++ unit testing framework for the 21st century
MIT License
1.94k stars 176 forks source link

`cr_assert_std[out|err]_eq_str` doesn't show both values #507

Open oliversheridanmethven opened 10 months ago

oliversheridanmethven commented 10 months ago

If I were to write a failing test like:

Test(capturing_output, std_out, .init = redirect_all_stdout)
{
    fprintf(stderr, "something");
    cr_assert_stderr_eq_str("something else");
}

The I get the following output:

example ..........................***Failed    0.20 sec
[----] ../../../../src/testing/tests/example.c:44: Assertion Failed
[----]   
[----]   The file contents of __stderrp does not match the string "something else".
[----]   
[FAIL] capturing_output::std_output_failure: (0.00s)

However, it would be much more helpful if it showed the output of stderr so I can see how it doesn't match.