check/check-0.15.1-fail-macros.patch
2020-08-03 11:48:57 -06:00

33 lines
1.1 KiB
Diff

--- check-0.15.1/src/check.h.in.orig 2020-07-22 08:19:48.000000000 -0600
+++ check-0.15.1/src/check.h.in 2020-08-03 11:41:08.131406149 -0600
@@ -466,7 +466,10 @@ static void __testname ## _fn (int _i CK
*
* 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
@@ -480,7 +483,7 @@ static void __testname ## _fn (int _i CK
*/
#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__)
/*
@@ -488,7 +491,7 @@ static void __testname ## _fn (int _i CK
*
* 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.