Tests: tuktest.h: Move a function.
This commit is contained in:
parent
70c7555f64
commit
1d51536a4b
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue