From 596468d3b929bb6d3324aa591873bab7bbb09e08 Mon Sep 17 00:00:00 2001 From: Aki Tuomi Date: Thu, 9 Aug 2018 12:38:43 +0300 Subject: [PATCH] lib-test: Warn if test_run or test_run_named result is not used Ensures hopefully that unit tests do not succeed when they fail due to wrong exit code. --- src/lib-test/test-common.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib-test/test-common.h b/src/lib-test/test-common.h index cba5a79865..0c84fab40d 100644 --- a/src/lib-test/test-common.h +++ b/src/lib-test/test-common.h @@ -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 */ -- 2.47.3