xref: /freebsd/bin/sh/tests/expansion/plus-minus7.0 (revision bc96366c864c07ef352edb92017357917c75b36c)
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