diff options
author | Mitya Selivanov <0x7fffff@guattari.ru> | 2022-08-25 01:16:34 +0400 |
---|---|---|
committer | Mitya Selivanov <0x7fffff@guattari.ru> | 2022-08-25 01:16:34 +0400 |
commit | b8b10fec5394b32c6de512edeefea0a700678abe (patch) | |
tree | b3991a50a761a341670799833b184db37ed90afb | |
parent | 21c0af13921a550dd1ae163f33f97325d1a8db3b (diff) | |
download | kit-b8b10fec5394b32c6de512edeefea0a700678abe.zip |
[kit_test] Output format
-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"); |