mirror of
https://codeberg.org/h3xx/simplify_static_dir
synced 2024-08-14 23:57:24 +00:00
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:
parent
5454fe681f
commit
c750b11c7e
1 changed files with 8 additions and 4 deletions
12
t/funcs.sh
12
t/funcs.sh
|
@ -4,25 +4,29 @@
|
||||||
echo_success() {
|
echo_success() {
|
||||||
printf '[\033[1;32m%s\033[0;39m] %s' \
|
printf '[\033[1;32m%s\033[0;39m] %s' \
|
||||||
' OK ' \
|
' OK ' \
|
||||||
"$*"
|
"$(escape_nonprinting "$*")"
|
||||||
}
|
}
|
||||||
|
|
||||||
echo_failure() {
|
echo_failure() {
|
||||||
printf '[\033[1;31m%s\033[0;39m] %s' \
|
printf '[\033[1;31m%s\033[0;39m] %s' \
|
||||||
'FAILED' \
|
'FAILED' \
|
||||||
"$*"
|
"$(escape_nonprinting "$*")"
|
||||||
}
|
}
|
||||||
|
|
||||||
echo_warning() {
|
echo_warning() {
|
||||||
printf '[\033[1;33m%s\033[0;39m] %s' \
|
printf '[\033[1;33m%s\033[0;39m] %s' \
|
||||||
'WARNING' \
|
'WARNING' \
|
||||||
"$*"
|
"$(escape_nonprinting "$*")"
|
||||||
}
|
}
|
||||||
|
|
||||||
echo_passed() {
|
echo_passed() {
|
||||||
printf '[\033[1;33m%s\033[0;39m] %s' \
|
printf '[\033[1;33m%s\033[0;39m] %s' \
|
||||||
'PASSED' \
|
'PASSED' \
|
||||||
"$*"
|
"$(escape_nonprinting "$*")"
|
||||||
|
}
|
||||||
|
|
||||||
|
escape_nonprinting() {
|
||||||
|
echo "$*" |cat -v
|
||||||
}
|
}
|
||||||
|
|
||||||
assert_equals() {
|
assert_equals() {
|
||||||
|
|
Loading…
Reference in a new issue