-
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #245 from h0adp0re/fix/output-colors
Increase contrast of test results
- Loading branch information
Showing
20 changed files
with
120 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,33 @@ | ||
#!/bin/bash | ||
|
||
# shellcheck disable=SC2034 | ||
_COLOR_DEFAULT=$'\e[0m' | ||
_COLOR_BOLD=$'\e[1m' | ||
_COLOR_FAINT=$'\e[2m' | ||
_COLOR_FAILED=$'\e[31m' | ||
_COLOR_PASSED=$'\e[32m' | ||
_COLOR_SKIPPED=$'\e[33m' | ||
_COLOR_INCOMPLETE=$'\e[36m' | ||
_COLOR_SNAPSHOT=$'\e[34m' | ||
_COLOR_RETURN_ERROR=$'\e[41m' | ||
_COLOR_RETURN_SUCCESS=$'\e[42m' | ||
_COLOR_RETURN_SKIPPED=$'\e[43m' | ||
_COLOR_RETURN_INCOMPLETE=$'\e[46m' | ||
_COLOR_RETURN_SNAPSHOT=$'\e[44m' | ||
# Pass in any number of ANSI SGR codes. | ||
# | ||
# Code reference: | ||
# https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters | ||
# Credit: | ||
# https://superuser.com/a/1119396 | ||
sgr() { | ||
local codes=${1:-0} | ||
shift | ||
|
||
for c in "$@"; do | ||
codes="$codes;$c" | ||
done | ||
|
||
echo $'\e'"[${codes}m" | ||
} | ||
|
||
_COLOR_DEFAULT="$(sgr 0)" | ||
_COLOR_BOLD="$(sgr 1)" | ||
_COLOR_FAINT="$(sgr 2)" | ||
_COLOR_BLACK="$(sgr 30)" | ||
_COLOR_FAILED="$(sgr 31)" | ||
_COLOR_PASSED="$(sgr 32)" | ||
_COLOR_SKIPPED="$(sgr 33)" | ||
_COLOR_INCOMPLETE="$(sgr 36)" | ||
_COLOR_SNAPSHOT="$(sgr 34)" | ||
_COLOR_RETURN_ERROR="$(sgr 41)$_COLOR_BLACK$_COLOR_BOLD" | ||
_COLOR_RETURN_SUCCESS="$(sgr 42)$_COLOR_BLACK$_COLOR_BOLD" | ||
_COLOR_RETURN_SKIPPED="$(sgr 43)$_COLOR_BLACK$_COLOR_BOLD" | ||
_COLOR_RETURN_INCOMPLETE="$(sgr 46)$_COLOR_BLACK$_COLOR_BOLD" | ||
_COLOR_RETURN_SNAPSHOT="$(sgr 44)$_COLOR_BLACK$_COLOR_BOLD" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
...apshots/bashunit_pass_test_sh.test_bashunit_when_a_test_passes_simple_output_env.snapshot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
.... | ||
[2mTests: [0m [32m4 passed[0m, 4 total | ||
[2mAssertions:[0m [32m6 passed[0m, 6 total | ||
[42mAll tests passed[0m | ||
|
||
[42m[30m[1m All tests passed [0m |
3 changes: 2 additions & 1 deletion
3
...hots/bashunit_pass_test_sh.test_bashunit_when_a_test_passes_simple_output_option.snapshot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
.... | ||
[2mTests: [0m [32m4 passed[0m, 4 total | ||
[2mAssertions:[0m [32m6 passed[0m, 6 total | ||
[42mAll tests passed[0m | ||
|
||
[42m[30m[1m All tests passed [0m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
...ce/snapshots/bashunit_path_test_sh.test_bashunit_argument_overloads_default_path.snapshot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
|
||
[2mTests: [0m 0 total | ||
[2mAssertions:[0m 0 total | ||
[41mNo tests found[0m | ||
|
||
[41m[30m[1m No tests found [0m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters