From 367917c6e78237851dd6cc82ba4e09874554a241 Mon Sep 17 00:00:00 2001 From: Kirk Scheibelhut Date: Tue, 25 Feb 2014 09:36:14 -0800 Subject: [PATCH] Add messages for failed tests --- date.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/date.c b/date.c index 44ecbfc..53ecaf3 100644 --- a/date.c +++ b/date.c @@ -1292,6 +1292,7 @@ static int test_show_date(time_t t, struct timeval *now, const char *expected) struct strbuf buf = STRBUF_INIT; show_date_relative(t, 0, now, &buf); if (strcmp(buf.buf, expected)) { + fprintf(stderr, "got: '%s', expected: '%s'\n", buf.buf, expected); fail = 1; } strbuf_release(&buf); @@ -1309,10 +1310,12 @@ static int test_parse_date(const char *input, struct timeval *now, const char *e parse_date(input, result, sizeof(result)); if (sscanf(result, "%lu %d", &t, &tz) == 2) { if (strcmp(show_date(t, tz, DATE_ISO8601), expected)) { + fprintf(stderr, "got: '%s', expected: '%s'\n", show_date(t, tz, DATE_ISO8601), expected); fail = 1; } } else { if (strcmp("bad", expected)) { + fprintf(stderr, "got: 'bad', expected: '%s'\n", expected); fail = 1; } } @@ -1325,7 +1328,7 @@ static int test_parse_approxidate(const char *input, struct timeval *now, const time_t t; t = approxidate_relative(input, now); if (strcmp(show_date(t, 0, DATE_ISO8601), expected)) { - fprintf(stderr, "%s\n", show_date(t, 0, DATE_ISO8601)); + fprintf(stderr, "got: '%s', expected: '%s'\n", show_date(t, 0, DATE_ISO8601), expected); fail = 1; } return fail;