]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-test: test-common - add test_out_quiet() to reduce verbosity
authorPhil Carmody <phil@dovecot.fi>
Thu, 3 Jul 2014 09:42:11 +0000 (12:42 +0300)
committerPhil Carmody <phil@dovecot.fi>
Thu, 3 Jul 2014 09:42:11 +0000 (12:42 +0300)
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 <phil@dovecot.fi>
src/lib-test/test-common.c
src/lib-test/test-common.h

index c4a29a96e52ae63c77f49d988936c919660eec43..e2cfa55c80f73ae27452b0719bac30c08cd904ec 100644 (file)
@@ -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;
index e7912be53e789941eb47031294648dc4f92676e4..44818937d0a44bea7f253ec98119c623d6ada375 100644 (file)
@@ -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);