logo

utils-std

Collection of commonly available Unix tools git clone https://anongit.hacktivis.me/git/utils-std.git/
commit: aaa48c82fe47a0c25e1f4f5efeddd74f757c0756
parent 909adecb75385b77e2bac89d110872e7011a027a
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Tue, 24 Jun 2025 23:38:07 +0200

test-cmd/tap.sh: Add # to printf format of test output

Diffstat:

Mtest-cmd/tap.sh22++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/test-cmd/tap.sh b/test-cmd/tap.sh @@ -51,14 +51,15 @@ t () if [ "$ret" != "$exp_ret" ]; then printf 'not ok %d - %s\n' "$count" "$1" printf '# Expected exit code %d, got %d\n' "$exp_ret" "$ret" - printf "$out" | sed -e 's;^;# ;' + printf '# == Got ==\n' + printf '# %s\n' "$out" | sed -e 's;^[^#];# ;' err=1 elif [ "$out" != "$3" ]; then printf 'not ok %d - %s\n' "$count" "$1" printf '# == Expected ==\n' - printf '%s\n' "$3" | sed -e 's;^;# ;' + printf '# %s\n' "$3" | sed -e 's;^[^#];# ;' printf '# == Got ==\n' - printf '%s\n' "$out" | sed -e 's;^;# ;' + printf '# %s\n' "$out" | sed -e 's;^[^#];# ;' err=1 else printf 'ok %d - %s\n' "$count" "$1" @@ -111,14 +112,15 @@ t_args() { if [ "$ret" != "$exp_ret" ]; then printf 'not ok %d - %s\n' "$count" "$name" printf '# Expected exit code %d, got %d\n' "$exp_ret" "$ret" - printf "$out" | sed -e 's;^;# ;' + printf '# == Got ==\n' + printf '# %s\n' "$out" | sed -e 's;^[^#];# ;' err=1 elif [ "$out" != "$exp_out" ]; then printf 'not ok %d - %s\n' "$count" "$name" printf '# == Expected ==\n' - printf '%s\n' "$exp_out" | sed -e 's;^;# ;' + printf '# %s\n' "$exp_out" | sed -e 's;^[^#];# ;' printf '# == Got ==\n' - printf '%s\n' "$out" | sed -e 's;^;# ;' + printf '# %s\n' "$out" | sed -e 's;^[^#];# ;' err=1 else printf 'ok %d - %s\n' "$count" "$name" @@ -172,7 +174,7 @@ t_file() if [ "$ret" != "$exp_ret" ]; then printf 'not ok %d - %s\n' "$count" "$name" printf '# Expected exit code %d, got %d\n' "$exp_ret" "$ret" - printf "$out" | sed -e 's;^;# ;' + printf '# %s\n' "$out" | sed -e 's;^[^#];# ;' err=1 elif ! cmp -s "${out?}" "$file"; then printf 'not ok %d - %s\n' "$count" "$name" @@ -220,14 +222,14 @@ t_cmd() { if [ "$ret" != "$exp_ret" ]; then printf 'not ok %d - %s\n' "$count" "$name" printf '# Expected exit code %d, got %d\n' "$exp_ret" "$ret" - printf "$out" | sed -e 's;^;# ;' + printf '# %s\n' "$out" | sed -e 's;^[^#];# ;' err=1 elif [ "$out" != "$exp_out" ]; then printf 'not ok %d - %s\n' "$count" "$name" printf '# == Expected ==\n' - printf '%s\n' "$exp_out" | sed -e 's;^;# ;' + printf '# %s\n' "$exp_out" | sed -e 's;^[^#];# ;' printf '# == Got ==\n' - printf '%s\n' "$out" | sed -e 's;^;# ;' + printf '# %s\n' "$out" | sed -e 's;^[^#];# ;' err=1 else printf 'ok %d - %s\n' "$count" "$name"