Update test

Make sure to print when a control character is present. If it doesn't,
it leads to confusion when bash reports two apparently-equal strings
don't actually match due to the presence of a non-printing character.
This commit is contained in:
Dan Church 2020-12-14 10:19:28 -06:00
parent 5454fe681f
commit c750b11c7e
Signed by: h3xx
GPG key ID: EA2BF379CD2CDBD0

View file

@ -4,25 +4,29 @@
echo_success() {
printf '[\033[1;32m%s\033[0;39m] %s' \
' OK ' \
"$*"
"$(escape_nonprinting "$*")"
}
echo_failure() {
printf '[\033[1;31m%s\033[0;39m] %s' \
'FAILED' \
"$*"
"$(escape_nonprinting "$*")"
}
echo_warning() {
printf '[\033[1;33m%s\033[0;39m] %s' \
'WARNING' \
"$*"
"$(escape_nonprinting "$*")"
}
echo_passed() {
printf '[\033[1;33m%s\033[0;39m] %s' \
'PASSED' \
"$*"
"$(escape_nonprinting "$*")"
}
escape_nonprinting() {
echo "$*" |cat -v
}
assert_equals() {