From 7895c947d5a51a6df2d48097e8e635dd606e39e2 Mon Sep 17 00:00:00 2001 From: Avery Pennarun Date: Sun, 3 Mar 2019 20:53:47 -0500 Subject: [PATCH] shelltest.od: warning 84 (W84) triggered on *all* shells, not just posh. I must have changed this at the last minute when adding it, but I don't know why. We were redefining f4() inside a subshell, so it never applied to the parent shell, so it was always considered a failure. But that's not what we were supposed to be testing. This is just supposed to be a test of the really rare syntax of defining a function without enclosing braces, which only fails on posh, as far as I've seen. --- t/shelltest.od | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/t/shelltest.od b/t/shelltest.od index ff64b51..0eee13e 100644 --- a/t/shelltest.od +++ b/t/shelltest.od @@ -323,8 +323,8 @@ foo=`exit 1`; [ "$?" != 0 ] || fail 72 f1() { echo 1; } f2(){ echo 2;} f3()(echo 3) -f4() { :; } -: $(quiet_stderr eval 'f4()if true; then echo 4; fi') +f4() { :; } # Note: redefined on next line +quiet_stderr eval 'f4()if true; then echo 4; fi' f5() ( exit 5 ) [ "$(f1)" = 1 ] || fail 81 [ "$(f2)" = 2 ] || fail 82 @@ -499,7 +499,7 @@ false # so we ended up always using bash, which leads people to write .do scripts # with bashisms. set x y z -# dotparams.od might warn 115 +# dotparams.od might warn 115, but should never return nonzero . ./dotparams.od a b || fail 117 [ "$1-$2-$3" = "x-y-z" ] || fail 116 @@ -508,7 +508,7 @@ set x y z # dock it some points so it doesn't always end up as the primary shell. [ 1 == 1 ] 2>/dev/null && warn 118 -# Some shells apparently don't support left padding in printf +# Some shells or OSes apparently don't support left padding in printf x=$(printf "a%-5sc" "b") [ "$x" = "ab c" ] || warn 119