xref: /freebsd/bin/sh/tests/expansion/cmdsubst7.0 (revision bdd1243df58e60e85101c09001d9812a789b6bc4)
1# $FreeBSD$
2
3failures=''
4ok=''
5
6testcase() {
7	code="$1"
8
9	unset v
10	eval ": \$($code)"
11
12	if [ "${v:+bad}" = "" ]; then
13		ok=x$ok
14	else
15		failures=x$failures
16		echo "Failure for $code"
17	fi
18}
19
20testcase ': ${v=0}'
21testcase ': ${v:=0}'
22testcase ': $((v=1))'
23testcase ': $((v+=1))'
24w='v=1'
25testcase ': $(($w))'
26testcase ': $((${$+v=1}))'
27testcase ': $((v${$+=1}))'
28testcase ': $((v $(echo =) 1))'
29testcase ': $(($(echo $w)))'
30
31test "x$failures" = x
32