From 1d51536a4b19a8fae768f8eb462fc2238cb36d53 Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Thu, 16 Jun 2022 11:47:37 +0300 Subject: [PATCH] Tests: tuktest.h: Move a function. --- tests/tuktest.h | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/tests/tuktest.h b/tests/tuktest.h index 0d22b891..ebc40eda 100644 --- a/tests/tuktest.h +++ b/tests/tuktest.h @@ -268,6 +268,28 @@ tuktest_basename(const char *filename) } +// Internal helper that prints the prefix of the fail/skip/error message line. +static void +tuktest_print_result_prefix(enum tuktest_result result, + const char *filename, unsigned line) +{ + // This is never called with TUKTEST_PASS but I kept it here anyway. + const char *result_str + = result == TUKTEST_PASS ? TUKTEST_STR_PASS + : result == TUKTEST_FAIL ? TUKTEST_STR_FAIL + : result == TUKTEST_SKIP ? TUKTEST_STR_SKIP + : TUKTEST_STR_ERROR; + + const char *short_filename = tuktest_basename(filename); + + if (tuktest_name != NULL) + printf("%s %s [%s:%u] ", result_str, tuktest_name, + short_filename, line); + else + printf("%s [%s:%u] ", result_str, short_filename, line); +} + + /// Initialize the test framework. No other functions or macros /// from this file may be called before calling this. /// @@ -459,28 +481,6 @@ tuktest_run_test(void (*testfunc)(void), const char *testfunc_str) } -// Internal helper that prints the prefix of the fail/skip/error message line. -static void -tuktest_print_result_prefix(enum tuktest_result result, - const char *filename, unsigned line) -{ - // This is never called with TUKTEST_PASS but I kept it here anyway. - const char *result_str - = result == TUKTEST_PASS ? TUKTEST_STR_PASS - : result == TUKTEST_FAIL ? TUKTEST_STR_FAIL - : result == TUKTEST_SKIP ? TUKTEST_STR_SKIP - : TUKTEST_STR_ERROR; - - const char *short_filename = tuktest_basename(filename); - - if (tuktest_name != NULL) - printf("%s %s [%s:%u] ", result_str, tuktest_name, - short_filename, line); - else - printf("%s [%s:%u] ", result_str, short_filename, line); -} - - // Maximum allowed file size in file_from_* macros and functions. #ifndef TUKTEST_FILE_SIZE_MAX # define TUKTEST_FILE_SIZE_MAX (64L << 20)