Skip to content

Commit ec1c9b2

Browse files
committed
Add colours to run-test
1 parent 73e070a commit ec1c9b2

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

run-tests.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3226,7 +3226,21 @@ function show_result($result, $tested, $tested_file, $extra = '', $temp_filename
32263226
global $temp_target, $temp_urlbase, $line_length, $SHOW_ONLY_GROUPS;
32273227

32283228
if (!$SHOW_ONLY_GROUPS || in_array($result, $SHOW_ONLY_GROUPS)) {
3229-
echo "$result $tested [$tested_file] $extra\n";
3229+
/* Use ANSI escape codes for colouring test result */
3230+
switch ( $result ) {
3231+
case 'PASS': // Light Green
3232+
$colour = "\e[1;32m{$result}\e[0m"; break;
3233+
case 'SKIP': // Light Gray
3234+
$colour = "\e[0;37m{$result}"; break;
3235+
case 'FAIL': // Light Red
3236+
$colour = "\e[1;31m{$result}\e[0m"; break;
3237+
case 'BORK': // Purple
3238+
$colour = "\e[0;35m{$result}\e[0m"; break;
3239+
default:
3240+
$colour = "\e[1;33m{$result}\e[0m"; break;
3241+
}
3242+
3243+
echo "$colour $tested [$tested_file] $extra\e[0m\n";
32303244
} elseif (!$SHOW_ONLY_GROUPS) {
32313245
clear_show_test();
32323246
}

0 commit comments

Comments
 (0)