From 9d8085074991d5c0a42d6fc96a2d1a3ee918aad1 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 08:17:24 +0200 Subject: Adding upstream version 5.1. Signed-off-by: Daniel Baumann --- tests/posixexp2.sub | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 tests/posixexp2.sub (limited to 'tests/posixexp2.sub') diff --git a/tests/posixexp2.sub b/tests/posixexp2.sub new file mode 100644 index 0000000..5c46192 --- /dev/null +++ b/tests/posixexp2.sub @@ -0,0 +1,37 @@ +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +x=a\ b +[ "$x" = "${x?}" ] || exit 1 +set -- ${x?} +{ [ "$#" = 2 ] && [ "$1" = a ] && [ "$2" = b ]; } || exit 1 +unset x +(echo ${x?abcdefg}) 2>&1 | grep abcdefg >/dev/null || exit 1 +${THIS_SH} -c 'unset foo; echo ${foo?}' 2>/dev/null && exit 2 +${THIS_SH} -c 'foo=; echo ${foo:?}' 2>/dev/null && exit 3 +${THIS_SH} -c 'foo=; echo ${foo?}' >/dev/null || exit 4 +${THIS_SH} -c 'foo=1; echo ${foo:?}' >/dev/null || exit 5 +${THIS_SH} -c 'echo ${!?}' 2>/dev/null && exit 6 +${THIS_SH} -c ':& echo ${!?}' >/dev/null || exit 7 +${THIS_SH} -c 'echo ${#?}' >/dev/null || exit 8 +${THIS_SH} -c 'echo ${*?}' 2>/dev/null && exit 9 +${THIS_SH} -c 'echo ${*?}' ${THIS_SH} x >/dev/null || exit 10 +${THIS_SH} -c 'echo ${1?}' 2>/dev/null && exit 11 +${THIS_SH} -c 'echo ${1?}' ${THIS_SH} x >/dev/null || exit 12 +${THIS_SH} -c 'echo ${2?}' ${THIS_SH} x 2>/dev/null && exit 13 +${THIS_SH} -c 'echo ${2?}' ${THIS_SH} x y >/dev/null || exit 14 + +${THIS_SH} -c $'echo $(( x+ )) \n exit 0' ${THIS_SH} 2>/dev/null && exit 15 + +exit 0 -- cgit v1.2.3