From 7045b040acf01d1daf67d8afb5a2ccbca167c040 Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Thu, 3 Aug 2017 21:23:59 +0200 Subject: [PATCH] tests/minicheck.c: Improve error message display --- expat/tests/minicheck.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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); } -- 2.40.0