]> git.saurik.com Git - apple/shell_cmds.git/blob - sh/tests/expansion/ifs4.0
shell_cmds-216.60.1.tar.gz
[apple/shell_cmds.git] / sh / tests / expansion / ifs4.0
1 # $FreeBSD: head/bin/sh/tests/expansion/ifs4.0 222361 2011-05-27 15:56:13Z jilles $
2
3 c=: e= s=' '
4 failures=''
5 ok=''
6
7 check_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
16 IFS='
17 '
18 set -- a b '' c
19 set -- $@
20 check_result 'set -- $@' "($#)($1)($2)($3)($4)" "(3)(a)(b)(c)()"
21
22 IFS=''
23 set -- a b '' c
24 set -- $@
25 check_result 'set -- $@' "($#)($1)($2)($3)($4)" "(3)(a)(b)(c)()"
26
27 set -- a b '' c
28 set -- $*
29 check_result 'set -- $*' "($#)($1)($2)($3)($4)" "(3)(a)(b)(c)()"
30
31 set -- a b '' c
32 set -- "$@"
33 check_result 'set -- "$@"' "($#)($1)($2)($3)($4)" "(4)(a)(b)()(c)"
34
35 set -- a b '' c
36 set -- "$*"
37 check_result 'set -- "$*"' "($#)($1)($2)($3)($4)" "(1)(abc)()()()"
38
39 test "x$failures" = x