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