diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/kit_test/test.c | 68 |
1 files changed, 48 insertions, 20 deletions
diff --git a/source/kit_test/test.c b/source/kit_test/test.c index 0e29806..ebd2a31 100644 --- a/source/kit_test/test.c +++ b/source/kit_test/test.c @@ -230,29 +230,57 @@ int kit_run_tests(int argc, char **argv) { int signum = kit_tests_list.tests[i].signal; if (signum >= 0 && signum < sizeof signames / sizeof *signames && - signames[signum] != NULL) - quiet || - printf("Signal \"%s\" (%d) for \"%s\" in \"%s\"!\n", - signames[signum], signum, - kit_tests_list.tests[i].test_name, - kit_tests_list.tests[i].test_file); - else - quiet || - printf("Unknown signal (%d) for \"%s\" in \"%s\"!\n", - signum, kit_tests_list.tests[i].test_name, - kit_tests_list.tests[i].test_file); + signames[signum] != NULL) { + quiet || printf("Signal \"%s\" (%d) for \"", + signames[signum], signum); + no_color || print_color(white); + quiet || printf("%s", kit_tests_list.tests[i].test_name); + no_color || print_color(light); + quiet || printf("\" in \""); + no_color || print_color(white); + quiet || printf("%s", kit_tests_list.tests[i].test_file + + file_root); + no_color || print_color(light); + quiet || printf("\"!.\n"); + } else { + quiet || printf("Unknown signal (%d) for \"", signum); + no_color || print_color(white); + quiet || printf("%s", kit_tests_list.tests[i].test_name); + no_color || print_color(light); + quiet || printf("\" in \""); + no_color || print_color(white); + quiet || printf("%s", kit_tests_list.tests[i].test_file + + file_root); + no_color || print_color(light); + quiet || printf("\"!.\n"); + } } if (kit_tests_list.tests[i].assertions > - KIT_TEST_ASSERTIONS_LIMIT) - quiet || printf("Too many assertions for \"%s\" in \"%s\"!\n", - kit_tests_list.tests[i].test_name, - kit_tests_list.tests[i].test_file); - else + KIT_TEST_ASSERTIONS_LIMIT) { + quiet || printf("Too many assertions for \""); + no_color || print_color(white); + quiet || printf("%s", kit_tests_list.tests[i].test_name); + no_color || print_color(light); + quiet || printf("\" in \""); + no_color || print_color(white); + quiet || printf("%s", kit_tests_list.tests[i].test_file + + file_root); + no_color || print_color(light); + quiet || printf("\"!.\n"); + } else for (int j = 0; j < kit_tests_list.tests[i].assertions; j++) - if (!kit_tests_list.tests[i].status[j]) - quiet || printf("Assertion on line %d in \"%s\" failed\n", - kit_tests_list.tests[i].line[j], - kit_tests_list.tests[i].test_file); + if (!kit_tests_list.tests[i].status[j]) { + quiet || printf("Assertion on line "); + no_color || print_color(white); + quiet || printf("%d", kit_tests_list.tests[i].line[j]); + no_color || print_color(light); + quiet || printf(" in \""); + no_color || print_color(white); + quiet || printf("%s", kit_tests_list.tests[i].test_file + + file_root); + no_color || print_color(light); + quiet || printf("\" failed.\n"); + } } quiet || printf("\n"); |