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