logo

utils-std

Collection of commonly available Unix tools git clone https://anongit.hacktivis.me/git/utils-std.git/
commit: 665aa6080f621075954c70547c967fb222ce726c
parent 435781c2370fcf51ded746841896b58cf1811d50
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Thu, 24 Jul 2025 11:18:59 +0200

test-cmd/tap.sh: t_cmd: write args when <name> is empty

Diffstat:

Mtest-cmd/tap.sh8+++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/test-cmd/tap.sh b/test-cmd/tap.sh @@ -7,7 +7,7 @@ count=0 err=0 # t [--exit=n] [--input=str] <test_name> <arguments> <expected_output> -t () +t() { exp_ret=0 for i; do @@ -212,6 +212,8 @@ t_cmd() { name="$1"; shift exp_out="$1"; shift + [ -z "${name}" ] && name="$*" + # Append a final slash so sh(1) doesn't trims final newlines out="$("$@" 2>&1;r=$?;printf %s /;exit $r)" ret="$?" @@ -236,7 +238,7 @@ t_cmd() { fi } -t_end () +t_end() { if [ $count -ne $plans ] then @@ -249,7 +251,7 @@ t_end () # $1 -> name # $2 -> reason for skipping -skip () +skip() { count=$((count+1)) name="$1"