dovecot-2.2: lib-test: test-common - add test_out_quiet() to red...

dovecot at dovecot.org dovecot at dovecot.org
Thu Jul 3 09:46:33 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/36d07648cec8
changeset: 17571:36d07648cec8
user:      Phil Carmody <phil at dovecot.fi>
date:      Thu Jul 03 12:42:11 2014 +0300
description:
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 <phil at dovecot.fi>

diffstat:

 src/lib-test/test-common.c |  9 +++++++++
 src/lib-test/test-common.h |  1 +
 2 files changed, 10 insertions(+), 0 deletions(-)

diffs (30 lines):

diff -r 636b10a03e95 -r 36d07648cec8 src/lib-test/test-common.c
--- a/src/lib-test/test-common.c	Thu Jul 03 12:42:11 2014 +0300
+++ b/src/lib-test/test-common.c	Thu Jul 03 12:42:11 2014 +0300
@@ -191,6 +191,15 @@
 	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 -r 636b10a03e95 -r 36d07648cec8 src/lib-test/test-common.h
--- a/src/lib-test/test-common.h	Thu Jul 03 12:42:11 2014 +0300
+++ b/src/lib-test/test-common.h	Thu Jul 03 12:42:11 2014 +0300
@@ -23,6 +23,7 @@
 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);
 


More information about the dovecot-cvs mailing list