diff options
author | EuAndreh <eu@euandre.org> | 2023-11-12 19:35:55 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2023-11-12 19:35:55 -0300 |
commit | caf8fc2c3dc74b2ea0bbdf85cda150b49573d243 (patch) | |
tree | 5f0d9c9c6352e9bf0b2c92779b801db7fb624129 | |
parent | src/{ircd,web}.js: Init stub servers (diff) | |
download | papod-caf8fc2c3dc74b2ea0bbdf85cda150b49573d243.tar.gz papod-caf8fc2c3dc74b2ea0bbdf85cda150b49573d243.tar.xz |
tests/assert-*.sh: Normalize output using yellow and green colors
-rwxr-xr-x | tests/assert-clean.sh | 5 | ||||
-rwxr-xr-x | tests/assert-deps.sh | 5 | ||||
-rwxr-xr-x | tests/assert-install.sh | 15 | ||||
-rw-r--r-- | tools/lib.sh | 11 |
4 files changed, 26 insertions, 10 deletions
diff --git a/tests/assert-clean.sh b/tests/assert-clean.sh index 3cd550c..ffa37a8 100755 --- a/tests/assert-clean.sh +++ b/tests/assert-clean.sh @@ -27,7 +27,8 @@ make -s clean { - printf '%s: "clean" target deletes all derived assets...' "$0" + printf '%s: "clean" target deletes all derived assets...' \ + "$(yellow "$0")" if [ -n "$(git status -s)" ]; then printf ' ERR.\n' @@ -43,5 +44,5 @@ make -s clean exit 1 fi - printf ' OK\n' + printf ' %s\n' "$(green 'OK')" } >&2 diff --git a/tests/assert-deps.sh b/tests/assert-deps.sh index a189d13..0c0f02e 100755 --- a/tests/assert-deps.sh +++ b/tests/assert-deps.sh @@ -36,8 +36,9 @@ awk ' } ' Makefile | LANG=POSIX.UTF-8 sort > "$F" -printf '%s: all JavaScript sources are listed in the Makefile...' "$0" >&2 +printf '%s: all JavaScript sources are listed in the Makefile...' \ + "$(yellow "$0")" >&2 git ls-files src/*.js tests/js/*.js | LANG=POSIX.UTF-8 sort | diff -U10 "$F" - -printf ' OK.\n'>&2 +printf ' %s\n' "$(green 'OK')" >&2 diff --git a/tests/assert-install.sh b/tests/assert-install.sh index 99e0fb7..f8c0104 100755 --- a/tests/assert-install.sh +++ b/tests/assert-install.sh @@ -12,16 +12,19 @@ PATH="$D/usr/bin:$PATH" NODE_PATH="$D/usr/lib/node:$NODE_PATH" { - printf '%s: that the papo(3js) library is installed correctly...' "$0" + printf '%s: that the papo(3js) library is installed correctly...' \ + "$(yellow "$0")" node -e 'require("papo");' - printf ' OK.\n' + printf ' %s\n' "$(green 'OK')" - printf '%s: that the papo(1) command is installed correctly...' "$0" + printf '%s: that the papo(1) command is installed correctly...' \ + "$(yellow "$0")" papo -V | grep -q '^papo ' - printf ' OK.\n' + printf ' %s\n' "$(green 'OK')" make -s DESTDIR="$D" uninstall - printf '%s: that the "uninstall" target removes everything...' "$0" + printf '%s: that the "uninstall" target removes everything...' \ + "$(yellow "$0")" if [ "$(find "$D" -not -type d | wc -l)" != 0 ]; then printf ' ERR.\n' cat <<-EOF @@ -31,5 +34,5 @@ NODE_PATH="$D/usr/lib/node:$NODE_PATH" EOF exit 1 fi - printf ' OK.\n' + printf ' %s\n' "$(green 'OK')" } >&2 diff --git a/tools/lib.sh b/tools/lib.sh index 9d183f9..23953d2 100644 --- a/tools/lib.sh +++ b/tools/lib.sh @@ -31,3 +31,14 @@ mkdtemp() { mkdir "$name" echo "$name" } + +END="\033[0m" +yellow() { + YELLOW="\033[0;33m" + printf "${YELLOW}${1}${END}" +} + +green() { + GREEN="\033[0;32m" + printf "${GREEN}${1}${END}" +} |