]> git.saurik.com Git - apple/shell_cmds.git/blame - sh/tests/expansion/pathname2.0
shell_cmds-198.tar.gz
[apple/shell_cmds.git] / sh / tests / expansion / pathname2.0
CommitLineData
71aad674
A
1# $FreeBSD$
2
3failures=0
4
5check() {
6 testcase=$1
7 expect=$2
8 eval "set -- $testcase"
9 actual="$*"
10 if [ "$actual" != "$expect" ]; then
11 failures=$((failures+1))
12 printf '%s\n' "For $testcase, expected $expect actual $actual"
13 fi
14}
15
16set -e
17T=$(mktemp -d ${TMPDIR:-/tmp}/sh-test.XXXXXX)
18trap 'rm -rf $T' 0
19cd -P $T
20
21mkdir testdir testdir2 'testdir/*' 'testdir/?' testdir/a testdir/b testdir2/b
22mkdir testdir2/.c
23touch testf 'testdir/*/1' 'testdir/?/1' testdir/a/1 testdir/b/1 testdir2/b/.a
24
25check '*\/' 'testdir/ testdir2/'
26check '"testdir/"*"/1"' 'testdir/*/1 testdir/?/1 testdir/a/1 testdir/b/1'
27check '"testdir/"*"/"*' 'testdir/*/1 testdir/?/1 testdir/a/1 testdir/b/1'
28check '"testdir/"*\/*' 'testdir/*/1 testdir/?/1 testdir/a/1 testdir/b/1'
29check '"testdir"*"/"*"/"*' 'testdir/*/1 testdir/?/1 testdir/a/1 testdir/b/1'
30
31exit $((failures != 0))