1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

add another comsub regress test variant (re: 6e515f1d)

This commit is contained in:
Martijn Dekker 2020-09-24 06:27:39 +02:00
parent 4ce486a7a4
commit 02a48218f3

View file

@ -501,8 +501,19 @@ x=$( $SHELL 2> /dev/null 'read <<< $(<'"$tmp"'/foofile) 2> /dev/null;print -r "$
# ======
# A syntax error should not occur if a command substitution is run on the same line
# as a here document.
$SHELL -c 'true << EOF || true "$(true)"
EOF' || err_exit 'placing a command substitution and here-doc on the same line causes a syntax error'
got=$("$SHELL" -c 'true << EOF || true "$(true)"
EOF' 2>&1) || err_exit 'placing a command substitution and here-doc on the same line causes a syntax error' \
"(got $(printf %q "$got"))"
# Another version of this regression from Red Hat bug 1036931
expect='gamma'
actual=$("$SHELL" -c 'cat <<EOF | tail -$((5-4))
alpha
beta
gamma
EOF' 2>&1)
[[ $actual == "$expect" ]] || err_exit 'Syntax error on arith expansion on same line as here-doc' \
"(expected $(printf %q "$expect"), got $(printf %q "$actual"))"
# A here-document in a command substitution should cause a syntax error if it isn't
# completed inside of the command substitution.