From 935c68573f8e63468723dc2691957637e4e6bcb7 Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Thu, 10 Jan 2019 18:48:02 -0500 Subject: Import /usr/src/bin/sh from FreeBSD 12.0-RELEASE --- bin/cash/tests/expansion/set-u1.0 | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 bin/cash/tests/expansion/set-u1.0 (limited to 'bin/cash/tests/expansion/set-u1.0') diff --git a/bin/cash/tests/expansion/set-u1.0 b/bin/cash/tests/expansion/set-u1.0 new file mode 100644 index 00000000..39f7e175 --- /dev/null +++ b/bin/cash/tests/expansion/set-u1.0 @@ -0,0 +1,29 @@ +# $FreeBSD: releng/12.0/bin/sh/tests/expansion/set-u1.0 213738 2010-10-12 18:20:38Z obrien $ + +${SH} -uc 'unset foo; echo $foo' 2>/dev/null && exit 1 +${SH} -uc 'foo=; echo $foo' >/dev/null || exit 1 +${SH} -uc 'foo=1; echo $foo' >/dev/null || exit 1 +# -/+/= are unaffected by set -u +${SH} -uc 'unset foo; echo ${foo-}' >/dev/null || exit 1 +${SH} -uc 'unset foo; echo ${foo+}' >/dev/null || exit 1 +${SH} -uc 'unset foo; echo ${foo=}' >/dev/null || exit 1 +# length/trimming are affected +${SH} -uc 'unset foo; echo ${#foo}' 2>/dev/null && exit 1 +${SH} -uc 'foo=; echo ${#foo}' >/dev/null || exit 1 +${SH} -uc 'unset foo; echo ${foo#?}' 2>/dev/null && exit 1 +${SH} -uc 'foo=1; echo ${foo#?}' >/dev/null || exit 1 +${SH} -uc 'unset foo; echo ${foo##?}' 2>/dev/null && exit 1 +${SH} -uc 'foo=1; echo ${foo##?}' >/dev/null || exit 1 +${SH} -uc 'unset foo; echo ${foo%?}' 2>/dev/null && exit 1 +${SH} -uc 'foo=1; echo ${foo%?}' >/dev/null || exit 1 +${SH} -uc 'unset foo; echo ${foo%%?}' 2>/dev/null && exit 1 +${SH} -uc 'foo=1; echo ${foo%%?}' >/dev/null || exit 1 + +${SH} -uc 'echo $!' 2>/dev/null && exit 1 +${SH} -uc ':& echo $!' >/dev/null || exit 1 +${SH} -uc 'echo $#' >/dev/null || exit 1 +${SH} -uc 'echo $1' 2>/dev/null && exit 1 +${SH} -uc 'echo $1' ${SH} x >/dev/null || exit 1 +${SH} -uc 'echo $2' ${SH} x 2>/dev/null && exit 1 +${SH} -uc 'echo $2' ${SH} x y >/dev/null || exit 1 +exit 0 -- cgit 1.4.1