]> git.saurik.com Git - apple/shell_cmds.git/blob - sh/tests/expansion/ifs1.0
shell_cmds-207.11.1.tar.gz
[apple/shell_cmds.git] / sh / tests / expansion / ifs1.0
1 # $FreeBSD: head/bin/sh/tests/expansion/ifs1.0 194981 2009-06-25 17:36:08Z 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 ''
19 set -- "$@"
20 check_result 'set -- "$@"' "($#)($1)($2)" "(2)(a)()"
21
22 set -- a ''
23 set -- "$@"$e
24 check_result 'set -- "$@"$e' "($#)($1)($2)" "(2)(a)()"
25
26 set -- a ''
27 set -- "$@"$s
28 check_result 'set -- "$@"$s' "($#)($1)($2)" "(2)(a)()"
29
30 IFS="$c"
31 set -- a ''
32 set -- "$@"$c
33 check_result 'set -- "$@"$c' "($#)($1)($2)" "(2)(a)()"
34
35 test "x$failures" = x