xref: /freebsd/bin/sh/tests/expansion/plus-minus5.0 (revision b1f9167f94059fd55c630891d359bcff987bd7eb)
1# $FreeBSD$
2
3e= q='?' a='*' t=texttext s='ast*que?non' p='/et[c]/' w='a b c' b='{{(#)}}'
4h='##'
5failures=''
6ok=''
7
8testcase() {
9	code="$1"
10	expected="$2"
11	oIFS="$IFS"
12	eval "$code"
13	IFS='|'
14	result="$#|$*"
15	IFS="$oIFS"
16	if [ "x$result" = "x$expected" ]; then
17		ok=x$ok
18	else
19		failures=x$failures
20		echo "For $code, expected $expected actual $result"
21	fi
22}
23
24testcase 'set -- ${e:-"{x}"}'			'1|{x}'
25testcase 'set -- "${e:-"{x}"}"'			'1|{x}'
26testcase 'set -- ${h+"{x}"}'			'1|{x}'
27testcase 'set -- "${h+"{x}"}"'			'1|{x}'
28testcase 'set -- ${h:-"{x}"}'			'1|##'
29testcase 'set -- "${h:-"{x}"}"'			'1|##'
30
31test "x$failures" = x
32