GUnit icon indicating copy to clipboard operation
GUnit copied to clipboard

:bug: Fix printing variables when expect or assert fails

Open dustingooding opened this issue 8 months ago • 2 comments

Problem:

  • EXPECT and ASSERT macros only print whether the expression is true or false when the test expectations fail
  • GUnit stopped printing out the values of the variables used in the expressiong passed to the EXPECT or ASSERT macros
  • Fix for logical expression broke variable printing

Solution:

  • Remove extra parenthesis in macros that resulted in full evaluation of the expression before the op and cmp objects could be initialized.
  • Add CmpHelperAnd/Or/Xor with corresponding and/or/xor overloads to allow evaluating logical expressions.
  • Added test to verify tested expressions are only evaluated once.

dustingooding avatar Mar 21 '25 20:03 dustingooding

thanks @dustingooding, LGTM, just a small complain from the compiler about C++20, otherwise happy to get that in.

kris-jusiak avatar Mar 21 '25 21:03 kris-jusiak

Actually, I don't think these errors are because of my changes. It looks like the MacOS and Windows failures started with #102?

dustingooding avatar Mar 23 '25 19:03 dustingooding