Skip to content

Commit

Permalink
Merge pull request #298 from libcheck/fail-extra-null
Browse files Browse the repository at this point in the history
Add extra NULL argument at the end of fail* APIs
  • Loading branch information
brarcher authored Aug 3, 2020
2 parents 134bc1e + 82540c5 commit 4ed1ae1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/check.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,10 @@ static void __testname ## _fn (int _i CK_ATTRIBUTE_UNUSED)
*
* This call is deprecated.
*/
#define fail_unless ck_assert_msg
#define fail_unless(expr, ...) \
(expr) ? \
_mark_point(__FILE__, __LINE__) : \
_ck_assert_failed(__FILE__, __LINE__, "Assertion '"#expr"' failed" , ## __VA_ARGS__, NULL)

/*
* Fail the test case if expr is false
Expand All @@ -480,15 +483,15 @@ static void __testname ## _fn (int _i CK_ATTRIBUTE_UNUSED)
*/
#define fail_if(expr, ...)\
(expr) ? \
_ck_assert_failed(__FILE__, __LINE__, "Failure '"#expr"' occurred" , ## __VA_ARGS__) \
_ck_assert_failed(__FILE__, __LINE__, "Failure '"#expr"' occurred" , ## __VA_ARGS__, NULL) \
: _mark_point(__FILE__, __LINE__)

/*
* Fail the test
*
* This call is deprecated.
*/
#define fail ck_abort_msg
#define fail(...) _ck_assert_failed(__FILE__, __LINE__, "Failed" , ## __VA_ARGS__, NULL)

/*
* This is called whenever an assertion fails.
Expand Down

0 comments on commit 4ed1ae1

Please sign in to comment.