diff options
author | Sebastian Pipping <sebastian@pipping.org> | 2020-10-25 20:10:43 +0100 |
---|---|---|
committer | Sebastian Pipping <sebastian@pipping.org> | 2020-10-25 21:14:18 +0100 |
commit | 263c76e324816dd10099aff1f3a8fda99f45a321 (patch) | |
tree | fbd89682f6ee5b1f9b08d4a09b31f63341b0f55d /expat/tests | |
parent | 6a7264e3836d0bf4f45c5fb3b236a3d230ec80e1 (diff) | |
download | expat-263c76e324816dd10099aff1f3a8fda99f45a321.tar.gz |
tests: Make argument -v more useful
Diffstat (limited to 'expat/tests')
-rw-r--r-- | expat/tests/minicheck.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/expat/tests/minicheck.c b/expat/tests/minicheck.c index d92c6ec6..79a6102a 100644 --- a/expat/tests/minicheck.c +++ b/expat/tests/minicheck.c @@ -141,11 +141,18 @@ _check_set_test_info(char const *function, char const *filename, int lineno) { } static void -add_failure(SRunner *runner, int verbosity) { +handle_success(int verbosity) { + if (verbosity >= CK_VERBOSE) { + printf("PASS: %s\n", _check_current_function); + } +} + +static void +handle_failure(SRunner *runner, int verbosity, const char *phase_info) { runner->nfailures++; if (verbosity >= CK_VERBOSE) { - printf("%s:%d: %s\n", _check_current_filename, _check_current_lineno, - _check_current_function); + printf("FAIL: %s (%s at %s:%d)\n", _check_current_function, phase_info, + _check_current_filename, _check_current_lineno); } } @@ -164,14 +171,14 @@ srunner_run_all(SRunner *runner, int verbosity) { if (tc->setup != NULL) { /* setup */ if (setjmp(env)) { - add_failure(runner, verbosity); + handle_failure(runner, verbosity, "during setup"); continue; } tc->setup(); } /* test */ if (setjmp(env)) { - add_failure(runner, verbosity); + handle_failure(runner, verbosity, "during actual test"); continue; } (tc->tests[i])(); @@ -179,11 +186,13 @@ srunner_run_all(SRunner *runner, int verbosity) { /* teardown */ if (tc->teardown != NULL) { if (setjmp(env)) { - add_failure(runner, verbosity); + handle_failure(runner, verbosity, "during teardown"); continue; } tc->teardown(); } + + handle_success(verbosity); } tc = tc->next_tcase; } |