1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-09-09 17:03:24 +02:00

Add colors to Octave unit test results.

This commit is contained in:
Max Maisel 2019-03-23 11:24:08 +01:00
parent d9608cddea
commit 1d60a3882f

View File

@ -128,6 +128,11 @@ function result = do_test(result, msg, skip = false)
global CURRENT_TEST; global CURRENT_TEST;
TESTS_RUN = TESTS_RUN + 1; TESTS_RUN = TESTS_RUN + 1;
ANSI_COLOR_RED = "\x1b[31m";
ANSI_COLOR_GREEN = "\x1b[32m";
ANSI_COLOR_YELLOW = "\x1b[33m";
ANSI_COLOR_RESET = "\x1b[0m";
suffix = ""; suffix = "";
if !strcmp(msg, "") if !strcmp(msg, "")
suffix = cstrcat(" - ", msg); suffix = cstrcat(" - ", msg);
@ -135,15 +140,21 @@ function result = do_test(result, msg, skip = false)
if skip if skip
TESTS_SKIPPED = TESTS_SKIPPED + 1; TESTS_SKIPPED = TESTS_SKIPPED + 1;
printf(ANSI_COLOR_YELLOW);
printf(cstrcat("[Skip]: ", CURRENT_TEST, suffix, "\n")); printf(cstrcat("[Skip]: ", CURRENT_TEST, suffix, "\n"));
printf(ANSI_COLOR_RESET);
result = 1; result = 1;
else else
if result if result
printf(ANSI_COLOR_GREEN);
printf(cstrcat("[Success]: ", CURRENT_TEST, suffix, "\n")); printf(cstrcat("[Success]: ", CURRENT_TEST, suffix, "\n"));
printf(ANSI_COLOR_RESET);
return; return;
else else
TESTS_FAILED = TESTS_FAILED + 1; TESTS_FAILED = TESTS_FAILED + 1;
printf(ANSI_COLOR_RED);
printf(cstrcat("[Failed]: ", CURRENT_TEST, suffix, "\n")); printf(cstrcat("[Failed]: ", CURRENT_TEST, suffix, "\n"));
printf(ANSI_COLOR_RESET);
return; return;
end end
end end