]> git.saurik.com Git - apple/shell_cmds.git/blob - sh/tests/parameters/positional8.0
shell_cmds-203.tar.gz
[apple/shell_cmds.git] / sh / tests / parameters / positional8.0
1 # $FreeBSD: head/bin/sh/tests/parameters/positional8.0 291025 2015-11-18 21:09:03Z jilles $
2
3 failures=''
4 ok=''
5
6 testcase() {
7 code="$1"
8 expected="$2"
9 oIFS="$IFS"
10 eval "$code"
11 IFS='|'
12 result="$#|$*"
13 IFS="$oIFS"
14 if [ "x$result" = "x$expected" ]; then
15 ok=x$ok
16 else
17 failures=x$failures
18 echo "For $code, expected $expected actual $result"
19 fi
20 }
21
22 testcase 'shift $#; set -- ""$*' '1|'
23 testcase 'shift $#; set -- $*""' '1|'
24 testcase 'shift $#; set -- ""$@' '1|'
25 testcase 'shift $#; set -- $@""' '1|'
26 testcase 'shift $#; set -- """$*"' '1|'
27 testcase 'shift $#; set -- "$*"""' '1|'
28 testcase 'shift $#; set -- """$@"' '1|'
29 testcase 'shift $#; set -- "$@"""' '1|'
30
31 test "x$failures" = x