xref: /freebsd/bin/sh/tests/expansion/plus-minus7.0 (revision 57718be8fa0bd5edc11ab9a72e68cc71982939a6)
1# $FreeBSD$
2
3e= s='foo'
4failures=''
5ok=''
6
7testcase() {
8	code="$1"
9	expected="$2"
10	oIFS="$IFS"
11	eval "$code"
12	IFS='|'
13	result="$#|$*"
14	IFS="$oIFS"
15	if [ "x$result" = "x$expected" ]; then
16		ok=x$ok
17	else
18		failures=x$failures
19		echo "For $code, expected $expected actual $result"
20	fi
21}
22
23testcase 'set -- ${s+a b}'			'2|a|b'
24testcase 'set -- ${e:-a b}'			'2|a|b'
25
26test "x$failures" = x
27