From a228c0698e61c163dec3f3e03a805ed6cc319283 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Thu, 6 Apr 2023 06:06:26 -0500 Subject: [PATCH] Fix redundant name appending when testcmd's first argument is blank. --- scripts/runtest.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/scripts/runtest.sh b/scripts/runtest.sh index cffedef0..ce6e0fd0 100644 --- a/scripts/runtest.sh +++ b/scripts/runtest.sh @@ -117,10 +117,10 @@ toyonly() # Takes five arguments: "name" "command" "result" "infile" "stdin" testing() { - NAME="$CMDNAME $1" wrong_args "$@" - [ -z "$1" ] && NAME=$2 + [ -z "$1" ] && NAME="$2" || NAME="$1" + [ "${NAME#$CMDNAME }" == "$NAME" ] && NAME="$CMDNAME $1" [ -n "$DEBUG" ] && set -x @@ -162,9 +162,7 @@ testcmd() { wrong_args "$@" - X="$1" - [ -z "$X" ] && X="$CMDNAME $2" - testing "$X" "\"$C\" $2" "$3" "$4" "$5" + testing "${1:-$CMDNAME $2}" "\"$C\" $2" "$3" "$4" "$5" } # Simple implementation of "expect" written in shell. -- 2.39.2