-
-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Increase contrast of test results #245
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
1689a47
fix: simplify editorconfig, fixes format on save in neovim
h0adp0re 04d27b6
refactor(colors): create a function `sgr` to give a `tput`-like experβ¦
h0adp0re 35cb65a
fix(colors): increase contrast of test results
h0adp0re 941ca75
feat: add whitespace to test summary status
h0adp0re 83a2c88
fix(cli): typo "filer" -> "filter"
h0adp0re 19ca2f6
fix: spelling & grammar mistakes in Makefile
h0adp0re File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this change necessary? It does make the test more readable, but the use of variables may defeat the purpose of the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that using app global variables removes part of the test's purpose, but it's as simple as redeclaring them locally (with different names) within the test and not using the application's global ones.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's all done now.