shelltest.od: detect some weird zsh problems.
This seems to only affect old zsh on MacOS. But we want to catch it anyway, because it caused t/351-deps-forget to fail in a weird way on that version of zsh. Shells really suck.
This commit is contained in:
parent
02f307578b
commit
07163d81cf
1 changed files with 28 additions and 0 deletions
|
|
@ -304,6 +304,30 @@ t8=$(a=1 f8)
|
|||
[ "$t8" = "1" ] || fail 88
|
||||
|
||||
|
||||
# Some versions of zsh (eg. 5.0.8 on MacOS, but not 5.3.1
|
||||
# on Debian) fail this one. It seems to be very specific:
|
||||
# "set -e" aborts the subshell, if a
|
||||
# function-within-a-function returns an error code, even
|
||||
# though there's an "|| true" there, but only if in the
|
||||
# else clause, and only if the outer () does *not* have an
|
||||
# "|| something" clause.
|
||||
#
|
||||
# "x || true" should not abort when set -e, even if x is
|
||||
# a function.
|
||||
(
|
||||
set -e
|
||||
f() { false; }
|
||||
g() { true | f; }
|
||||
if false; then
|
||||
:
|
||||
else
|
||||
! g || true
|
||||
fi
|
||||
)
|
||||
rv=$?
|
||||
[ "$rv" = 0 ] || fail 89
|
||||
|
||||
|
||||
# http://www.gnu.org/software/hello/manual/autoconf/Limitations-of-Builtins.html
|
||||
. /dev/null || fail 90
|
||||
(! : | :) && fail 91 || true
|
||||
|
|
@ -389,5 +413,9 @@ 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
|
||||
x=$(printf "a%-5sc" "b")
|
||||
[ "$x" = "ab c" ] || warn 119
|
||||
|
||||
[ -n "$FAIL" ] || exit 40
|
||||
exit $FAIL
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue