xref: /freebsd/bin/sh/tests/expansion/ifs4.0 (revision 1719886f6d08408b834d270c59ffcfd821c8f63a)
1
2c=: e= s=' '
3failures=''
4ok=''
5
6check_result() {
7	if [ "x$2" = "x$3" ]; then
8		ok=x$ok
9	else
10		failures=x$failures
11		echo "For $1, expected $3 actual $2"
12	fi
13}
14
15IFS='
16'
17set -- a b '' c
18set -- $@
19check_result 'set -- $@' "($#)($1)($2)($3)($4)" "(3)(a)(b)(c)()"
20
21IFS=''
22set -- a b '' c
23set -- $@
24check_result 'set -- $@' "($#)($1)($2)($3)($4)" "(3)(a)(b)(c)()"
25
26set -- a b '' c
27set -- $*
28check_result 'set -- $*' "($#)($1)($2)($3)($4)" "(3)(a)(b)(c)()"
29
30set -- a b '' c
31set -- "$@"
32check_result 'set -- "$@"' "($#)($1)($2)($3)($4)" "(4)(a)(b)()(c)"
33
34set -- a b '' c
35set -- "$*"
36check_result 'set -- "$*"' "($#)($1)($2)($3)($4)" "(1)(abc)()()()"
37
38test "x$failures" = x
39