From a201835e6f7631b250ce1d87d9e4b14f473d0f5c Mon Sep 17 00:00:00 2001 From: Bartosz Golaszewski Date: Fri, 9 Jun 2017 10:55:53 +0200 Subject: [PATCH] tests: tweak test output Tweak the log message header a bit: instead of having a fixed width of the contents between the brackets in the header, fix the length of the whole header to 8 characters. Signed-off-by: Bartosz Golaszewski --- tests/gpiod-test.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/gpiod-test.c b/tests/gpiod-test.c index 49a8e7f..10edd2b 100644 --- a/tests/gpiod-test.c +++ b/tests/gpiod-test.c @@ -126,8 +126,12 @@ static TEST_PRINTF(1, 2) void pr_raw(const char *fmt, ...) static void print_header(const char *hdr, int color) { + char buf[9]; + + snprintf(buf, sizeof(buf), "[%s]", hdr); + set_color(color); - pr_raw("[%-5s] ", hdr); + pr_raw("%-8s", buf); reset_color(); } -- 2.30.2