Skip to content
Snippets Groups Projects
Commit 83e9fb21 authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

curlcheck.h: add fail_if() fix code

The UNITTEST_START and UNITTEST_STOP defines needed to do a new brace
level so that test cases can declare variables fine and still remain
fine C89 code.
parent 5c42b2ce
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,13 @@
#include "test.h"
#define fail_if(expr, msg) \
if(expr) { \
fprintf(stderr, "%s:%d Assertion '%s' met: %s" , \
__FILE__, __LINE__, #expr, msg); \
unitfail++; \
}
#define fail_unless(expr, msg) \
if(!(expr)) { \
fprintf(stderr, "%s:%d Assertion '%s' failed: %s" , \
......@@ -22,9 +29,11 @@ extern int unitfail;
int test(char *unused) \
{ \
(void)unused; \
unit_setup();
unit_setup(); \
{
#define UNITTEST_STOP \
} \
unit_stop(); \
return unitfail; \
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment