commit: 192b1f3f4988b3f961c45cd9c1fbe95db5a6d939
parent c9e9194dd4ed1796f28c594bf27f75fbe7d1e9ea
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Sun, 13 Apr 2025 09:34:58 +0200
test-cmd/tap.sh: Avoid echo(1) for printing arbitrary values
Not only default behavior for backslashes is undefined but so is
first operand starting with /-[eEn]+/
Diffstat:
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/test-cmd/tap.sh b/test-cmd/tap.sh
@@ -56,9 +56,9 @@ t ()
elif [ "$out" != "$3" ]; then
printf 'not ok %d - %s\n' "$count" "$1"
printf '# == Expected ==\n'
- echo "$3" | sed -e 's;^;# ;'
+ printf '%s\n' "$3" | sed -e 's;^;# ;'
printf '# == Got ==\n'
- echo "$out" | sed -e 's;^;# ;'
+ printf '%s\n' "$out" | sed -e 's;^;# ;'
err=1
else
printf 'ok %d - %s\n' "$count" "$1"
@@ -116,9 +116,9 @@ t_args() {
elif [ "$out" != "$exp_out" ]; then
printf 'not ok %d - %s\n' "$count" "$name"
printf '# == Expected ==\n'
- echo "$exp_out" | sed -e 's;^;# ;'
+ printf '%s\n' "$exp_out" | sed -e 's;^;# ;'
printf '# == Got ==\n'
- echo "$out" | sed -e 's;^;# ;'
+ printf '%s\n' "$out" | sed -e 's;^;# ;'
err=1
else
printf 'ok %d - %s\n' "$count" "$name"
@@ -225,9 +225,9 @@ t_cmd() {
elif [ "$out" != "$exp_out" ]; then
printf 'not ok %d - %s\n' "$count" "$name"
printf '# == Expected ==\n'
- echo "$exp_out" | sed -e 's;^;# ;'
+ printf '%s\n' "$exp_out" | sed -e 's;^;# ;'
printf '# == Got ==\n'
- echo "$out" | sed -e 's;^;# ;'
+ printf '%s\n' "$out" | sed -e 's;^;# ;'
err=1
else
printf 'ok %d - %s\n' "$count" "$name"
@@ -256,7 +256,7 @@ skip ()
}
if ! test -f "${target?}"; then
- echo '1..0 # SKIP: missing executable: ' "${target?}"
+ printf '1..0 # SKIP: missing executable: %s\n' "${target?}"
exit 0
fi