1# $FreeBSD: head/tools/regression/bin/sh/expansion/plus-minus7.0 216738 2010-12-27 15:57:41Z emaste $ 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