]> git.saurik.com Git - apple/shell_cmds.git/blob - sh/tests/expansion/plus-minus7.0
shell_cmds-216.60.1.tar.gz
[apple/shell_cmds.git] / sh / tests / expansion / plus-minus7.0
1 # $FreeBSD: head/bin/sh/tests/expansion/plus-minus7.0 216738 2010-12-27 15:57:41Z emaste $
2
3 e= s='foo'
4 failures=''
5 ok=''
6
7 testcase() {
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
23 testcase 'set -- ${s+a b}' '2|a|b'
24 testcase 'set -- ${e:-a b}' '2|a|b'
25
26 test "x$failures" = x