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