aboutsummaryrefslogtreecommitdiffstats
path: root/tests/posixexp1.sub
diff options
context:
space:
mode:
authorSebastian Schmidt <yath@yath.de>2012-04-17 11:23:35 +0200
committerSebastian Schmidt <yath@yath.de>2012-04-17 11:24:20 +0200
commitf4b417c62a4f272c4cf9a074d0f7a3a97201f9db (patch)
treee2196f3b6361e2377c43ab47a3abf17d8f6afd77 /tests/posixexp1.sub
parent791237e44695d2ee123c8a6f665ef074f5fadfbb (diff)
downloadexternal_bash-f4b417c62a4f272c4cf9a074d0f7a3a97201f9db.zip
external_bash-f4b417c62a4f272c4cf9a074d0f7a3a97201f9db.tar.gz
external_bash-f4b417c62a4f272c4cf9a074d0f7a3a97201f9db.tar.bz2
Update to upstream bash 4.2
This upgrades bash to from 4.1-rc to 4.2-release. See CWRU/changelog for changes. Change-Id: I926269c300cf44fa25964b5b375a148fcf11c4b7
Diffstat (limited to 'tests/posixexp1.sub')
-rw-r--r--tests/posixexp1.sub30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/posixexp1.sub b/tests/posixexp1.sub
new file mode 100644
index 0000000..ce0b29d
--- /dev/null
+++ b/tests/posixexp1.sub
@@ -0,0 +1,30 @@
+# $FreeBSD: src/tools/regression/bin/sh/expansion/set-u1.0,v 1.2 2010/10/12 18:20:38 obrien Exp $
+
+${THIS_SH} -uc 'unset foo; echo ${foo}' 2>/dev/null && exit 1
+${THIS_SH} -uc 'unset foo; echo $foo' 2>/dev/null && exit 1
+${THIS_SH} -uc 'foo=; echo $foo' >/dev/null || exit 2
+${THIS_SH} -uc 'foo=1; echo $foo' >/dev/null || exit 3
+# -/+/= are unaffected by set -u
+${THIS_SH} -uc 'unset foo; echo ${foo-}' >/dev/null || exit 4
+${THIS_SH} -uc 'unset foo; echo ${foo+}' >/dev/null || exit 5
+${THIS_SH} -uc 'unset foo; echo ${foo=}' >/dev/null || exit 6
+# length/trimming are affected
+${THIS_SH} -uc 'unset foo; echo ${#foo}' 2>/dev/null && exit 7
+${THIS_SH} -uc 'foo=; echo ${#foo}' >/dev/null || exit 8
+${THIS_SH} -uc 'unset foo; echo ${foo#?}' 2>/dev/null && exit 9
+${THIS_SH} -uc 'foo=1; echo ${foo#?}' >/dev/null || exit 10
+${THIS_SH} -uc 'unset foo; echo ${foo##?}' 2>/dev/null && exit 11
+${THIS_SH} -uc 'foo=1; echo ${foo##?}' >/dev/null || exit 12
+${THIS_SH} -uc 'unset foo; echo ${foo%?}' 2>/dev/null && exit 13
+${THIS_SH} -uc 'foo=1; echo ${foo%?}' >/dev/null || exit 14
+${THIS_SH} -uc 'unset foo; echo ${foo%%?}' 2>/dev/null && exit 15
+${THIS_SH} -uc 'foo=1; echo ${foo%%?}' >/dev/null || exit 16
+
+${THIS_SH} -uc 'echo $!' 2>/dev/null && exit 17
+${THIS_SH} -uc ':& echo $!' >/dev/null || exit 18
+${THIS_SH} -uc 'echo $#' >/dev/null || exit 19
+${THIS_SH} -uc 'echo $1' 2>/dev/null && exit 20
+${THIS_SH} -uc 'echo $1' ${THIS_SH} xnotthere >/dev/null || exit 21
+${THIS_SH} -uc 'echo $2' ${THIS_SH} xnotthere 2>/dev/null && exit 22
+${THIS_SH} -uc 'echo $2' ${THIS_SH} xnotthere ynotthere >/dev/null || exit 23
+exit 0