commit: c343f9b2e86d9ba52d9fcb33033336e8a038b435
parent d2b4c0cd845f1a5e47af06b48b239bbfb902c66e
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Fri, 14 Feb 2025 07:19:43 +0100
test-cmd/{tap,mktemp}.sh: remplace 'echo -n' with 'printf %s'
Thanks to Geoff Clare
Diffstat:
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/test-cmd/mktemp.sh b/test-cmd/mktemp.sh
@@ -11,7 +11,7 @@ t_mktemp()
 	count=$((count+1))
 
 	# Append a final slash so sh(1) doesn't trims final newlines
-	out="$("${target?}" $2 2>&1;r=$?;echo -n /;exit $r)"
+	out="$("${target?}" $2 2>&1;r=$?;printf %s /;exit $r)"
 	ret="$?"
 	out="${out%/}"
 
@@ -38,7 +38,7 @@ t_mkdtemp()
 	count=$((count+1))
 
 	# Append a final slash so sh(1) doesn't trims final newlines
-	out="$("${target?}" $2 2>&1;r=$?;echo -n /;exit $r)"
+	out="$("${target?}" $2 2>&1;r=$?;printf %s /;exit $r)"
 	ret="$?"
 	out="${out%/}"
 
diff --git a/test-cmd/tap.sh b/test-cmd/tap.sh
@@ -37,11 +37,11 @@ t ()
 
 	if [ "${input+set}" = "set" ]; then
 		# Append a final slash so sh(1) doesn't trims final newlines
-		out="$(printf "${input?}" | "${target?}" $2 2>&1;r=$?;echo -n /;exit $r)"
+		out="$(printf "${input?}" | "${target?}" $2 2>&1;r=$?;printf %s /;exit $r)"
 		ret="$?"
 	else
 		# Append a final slash so sh(1) doesn't trims final newlines
-		out="$("${target?}" $2 2>&1;r=$?;echo -n /;exit $r)"
+		out="$("${target?}" $2 2>&1;r=$?;printf %s /;exit $r)"
 		ret="$?"
 	fi
 
@@ -97,11 +97,11 @@ t_args() {
 
 	if [ "${input+set}" = "set" ]; then
 		# Append a final slash so sh(1) doesn't trims final newlines
-		out="$(printf "${input?}" | "${target?}" "$@" 2>&1;r=$?;echo -n /;exit $r)"
+		out="$(printf "${input?}" | "${target?}" "$@" 2>&1;r=$?;printf %s /;exit $r)"
 		ret="$?"
 	else
 		# Append a final slash so sh(1) doesn't trims final newlines
-		out="$("${target?}" "$@" 2>&1;r=$?;echo -n /;exit $r)"
+		out="$("${target?}" "$@" 2>&1;r=$?;printf %s /;exit $r)"
 		ret="$?"
 	fi
 
@@ -211,7 +211,7 @@ t_cmd() {
 	exp_out="$1"; shift
 
 	# Append a final slash so sh(1) doesn't trims final newlines
-	out="$("$@" 2>&1;r=$?;echo -n /;exit $r)"
+	out="$("$@" 2>&1;r=$?;printf %s /;exit $r)"
 	ret="$?"
 	out="${out%/}"