changeset 7047:3fe934d0843a HEAD

Added test_out_reason()
author Timo Sirainen <tss@iki.fi>
date Sat, 29 Dec 2007 01:02:28 +0200
parents e74a1d1dca07
children 2eeb9b2d8f9a
files src/tests/test-common.c src/tests/test-common.h
diffstat 2 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/tests/test-common.c	Fri Dec 28 20:04:43 2007 +0200
+++ b/src/tests/test-common.c	Sat Dec 29 01:02:28 2007 +0200
@@ -39,6 +39,11 @@
 
 void test_out(const char *name, bool success)
 {
+	test_out_reason(name, success, NULL);
+}
+
+void test_out_reason(const char *name, bool success, const char *reason)
+{
 	int i;
 
 	fputs(name, stdout);
@@ -47,11 +52,14 @@
 		putchar('.');
 	fputs(" : ", stdout);
 	if (success)
-		puts("ok");
+		fputs("ok", stdout);
 	else {
-		puts("FAILED");
+		fputs("FAILED", stdout);
 		failure_count++;
 	}
+	if (reason != NULL && *reason != '\0')
+		printf(": %s", reason);
+	putchar('\n');
 	total_count++;
 }
 
--- a/src/tests/test-common.h	Fri Dec 28 20:04:43 2007 +0200
+++ b/src/tests/test-common.h	Sat Dec 29 01:02:28 2007 +0200
@@ -5,6 +5,7 @@
 void test_istream_set_size(struct istream *input, uoff_t size);
 
 void test_out(const char *name, bool success);
+void test_out_reason(const char *name, bool success, const char *reason);
 
 void test_init(void);
 int test_deinit(void);