Skip to content

Commit

Permalink
test: Add color to test.sh stdout for easier readability
Browse files Browse the repository at this point in the history
  • Loading branch information
Frazer Clews committed Jun 9, 2022
1 parent 28a61e8 commit 7415785
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,24 @@ message()
sed "s/$gi_re/gi/"
}

RED=''
GREEN=''
NC=''
if [ -t 1 ] && command -v tput > /dev/null 2>&1 && [ "$(tput colors)" -gt 2 ] ; then
RED=$(tput setaf 1)
GREEN=$(tput setaf 2)
NC=$(tput sgr0)
fi

ok()
{
message ok "$*"
message ${GREEN}ok${NC} "$*"
}

fail()
{
printf "%d " "$ntest" >>"$TopDir/failure"
message fail "$*"
message ${RED}fail${NC} "$*"
}

# Test specified command, which should succeed
Expand Down

0 comments on commit 7415785

Please sign in to comment.