xref: /freebsd/bin/sh/tests/expansion/ifs4.0 (revision 57718be8fa0bd5edc11ab9a72e68cc71982939a6)
1# $FreeBSD$
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
40