From: Sebastian Pipping Date: Thu, 3 Aug 2017 19:23:59 +0000 (+0200) Subject: tests/minicheck.c: Improve error message display X-Git-Tag: R_2_2_4~24^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7045b040acf01d1daf67d8afb5a2ccbca167c040;p=libexpat tests/minicheck.c: Improve error message display --- diff --git a/expat/tests/minicheck.c b/expat/tests/minicheck.c index a6cae231..e6266ca4 100644 --- a/expat/tests/minicheck.c +++ b/expat/tests/minicheck.c @@ -9,6 +9,7 @@ #include #include #include +#include #include "internal.h" /* for UNUSED_P only */ #include "minicheck.h" @@ -186,8 +187,10 @@ _fail_unless(int UNUSED_P(condition), const char *UNUSED_P(file), int UNUSED_P(l we have a failure, so there's no reason to be quiet about what it is. */ - if (msg != NULL) - printf("%s", msg); + if (msg != NULL) { + const int has_newline = (msg[strlen(msg) - 1] == '\n'); + fprintf(stderr, "ERROR: %s%s", msg, has_newline ? "" : "\n"); + } longjmp(env, 1); }