From: Phil Carmody Date: Thu, 3 Jul 2014 09:42:11 +0000 (+0300) Subject: lib-test: test-common - add test_out_quiet() to reduce verbosity X-Git-Tag: 2.2.14.rc1~299 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=00a34f888890caf56c66ff4d15445cab58ebd8d2;p=thirdparty%2Fdovecot%2Fcore.git lib-test: test-common - add test_out_quiet() to reduce verbosity Like test_out() but only prints anything if success is false. This makes it quite much like test_assert(), except that it doesn't print the code fragment, it prints a custom string. However, it still counts as a test in the total count, unlike test_assert*()s. Signed-off-by: Phil Carmody --- diff --git a/src/lib-test/test-common.c b/src/lib-test/test-common.c index c4a29a96e5..e2cfa55c80 100644 --- a/src/lib-test/test-common.c +++ b/src/lib-test/test-common.c @@ -191,6 +191,15 @@ void test_out(const char *name, bool success) test_out_reason(name, success, NULL); } +void test_out_quiet(const char *name, bool success) +{ + if (success) { + total_count++; + return; + } + test_out(name, success); +} + void test_out_reason(const char *name, bool success, const char *reason) { int i = 0; diff --git a/src/lib-test/test-common.h b/src/lib-test/test-common.h index e7912be53e..44818937d0 100644 --- a/src/lib-test/test-common.h +++ b/src/lib-test/test-common.h @@ -23,6 +23,7 @@ bool test_has_failed(void); void test_end(void); void test_out(const char *name, bool success); +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);