summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Maniero <carlos@maniero.me>2023-05-03 22:11:12 -0300
committerJohnny Richard <johnny@johnnyrichard.com>2023-05-04 21:44:22 +0200
commit8655b77d57ace45d4d040ef297cf172f3c12f4bd (patch)
tree76141706ce6dcd5024aadbc807e0b729f1677425
parent7418ad7ddc1651b973e0a67cf09f7fdfa23faae4 (diff)
munit: Show the filename as the first when error
Munit uses the follow format: Error: file.c:line: error message But this error format does not works well with vim make program. This commit changes the error to the follow format: file.c:line: Error: error message Signed-off-by: Carlos Maniero <carlos@maniero.me>
-rw-r--r--test/munit.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/test/munit.c b/test/munit.c
index 2500018..43e8e13 100644
--- a/test/munit.c
+++ b/test/munit.c
@@ -171,6 +171,9 @@ munit_logf_exv(MunitLogLevel level, FILE* fp, const char* filename, int line, co
if (level < munit_log_level_visible)
return;
+ if (filename != NULL)
+ fprintf(fp, "%s:%d: ", filename, line);
+
switch (level) {
case MUNIT_LOG_DEBUG:
fputs("Debug", fp);
@@ -190,8 +193,6 @@ munit_logf_exv(MunitLogLevel level, FILE* fp, const char* filename, int line, co
}
fputs(": ", fp);
- if (filename != NULL)
- fprintf(fp, "%s:%d: ", filename, line);
vfprintf(fp, format, ap);
fputc('\n', fp);
}