Skip to content

Commit

Permalink
lib-test: Warn if test_run or test_run_named result is not used
Browse files Browse the repository at this point in the history
Ensures hopefully that unit tests do not succeed when they fail
due to wrong exit code.
  • Loading branch information
cmouse authored and villesavolainen committed Feb 6, 2019
1 parent 314aba4 commit 00d0052
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib-test/test-common.h
Expand Up @@ -52,12 +52,12 @@ void test_out_quiet(const char *name, bool success); /* only prints failures */
void test_out_reason(const char *name, bool success, const char *reason)
ATTR_NULL(3);

int test_run(void (*const test_functions[])(void));
int test_run(void (*const test_functions[])(void)) ATTR_WARN_UNUSED_RESULT;
struct named_test {
const char *name;
void (*func)(void);
};
int test_run_named(const struct named_test tests[], const char *match);
int test_run_named(const struct named_test tests[], const char *match) ATTR_WARN_UNUSED_RESULT;

#define TEST_DECL(x) void x(void);
#define TEST_NAMELESS(x) x, /* Were you to want to use the X trick but not name the tests */
Expand Down

0 comments on commit 00d0052

Please sign in to comment.