]> git.saurik.com Git - apple/shell_cmds.git/blame - sh/tests/expansion/ifs4.0
shell_cmds-207.11.1.tar.gz
[apple/shell_cmds.git] / sh / tests / expansion / ifs4.0
CommitLineData
deb63bfb 1# $FreeBSD: head/bin/sh/tests/expansion/ifs4.0 222361 2011-05-27 15:56:13Z jilles $
71aad674
A
2
3c=: e= s=' '
4failures=''
5ok=''
6
7check_result() {
8 if [ "x$2" = "x$3" ]; then
9 ok=x$ok
10 else
11 failures=x$failures
12 echo "For $1, expected $3 actual $2"
13 fi
14}
15
16IFS='
17'
18set -- a b '' c
19set -- $@
20check_result 'set -- $@' "($#)($1)($2)($3)($4)" "(3)(a)(b)(c)()"
21
22IFS=''
23set -- a b '' c
24set -- $@
25check_result 'set -- $@' "($#)($1)($2)($3)($4)" "(3)(a)(b)(c)()"
26
27set -- a b '' c
28set -- $*
29check_result 'set -- $*' "($#)($1)($2)($3)($4)" "(3)(a)(b)(c)()"
30
31set -- a b '' c
32set -- "$@"
33check_result 'set -- "$@"' "($#)($1)($2)($3)($4)" "(4)(a)(b)()(c)"
34
35set -- a b '' c
36set -- "$*"
37check_result 'set -- "$*"' "($#)($1)($2)($3)($4)" "(1)(abc)()()()"
38
39test "x$failures" = x