]>
Commit | Line | Data |
---|---|---|
deb63bfb A |
1 | # $FreeBSD: head/bin/sh/tests/expansion/pathname2.0 302937 2016-07-16 13:26:18Z ache $ |
2 | ||
3 | unset LC_ALL | |
4 | LC_COLLATE=C | |
5 | export LC_COLLATE | |
71aad674 A |
6 | |
7 | failures=0 | |
8 | ||
9 | check() { | |
10 | testcase=$1 | |
11 | expect=$2 | |
12 | eval "set -- $testcase" | |
13 | actual="$*" | |
14 | if [ "$actual" != "$expect" ]; then | |
15 | failures=$((failures+1)) | |
16 | printf '%s\n' "For $testcase, expected $expect actual $actual" | |
17 | fi | |
18 | } | |
19 | ||
20 | set -e | |
21 | T=$(mktemp -d ${TMPDIR:-/tmp}/sh-test.XXXXXX) | |
22 | trap 'rm -rf $T' 0 | |
23 | cd -P $T | |
24 | ||
25 | mkdir testdir testdir2 'testdir/*' 'testdir/?' testdir/a testdir/b testdir2/b | |
26 | mkdir testdir2/.c | |
27 | touch testf 'testdir/*/1' 'testdir/?/1' testdir/a/1 testdir/b/1 testdir2/b/.a | |
28 | ||
29 | check '*\/' 'testdir/ testdir2/' | |
30 | check '"testdir/"*"/1"' 'testdir/*/1 testdir/?/1 testdir/a/1 testdir/b/1' | |
31 | check '"testdir/"*"/"*' 'testdir/*/1 testdir/?/1 testdir/a/1 testdir/b/1' | |
32 | check '"testdir/"*\/*' 'testdir/*/1 testdir/?/1 testdir/a/1 testdir/b/1' | |
33 | check '"testdir"*"/"*"/"*' 'testdir/*/1 testdir/?/1 testdir/a/1 testdir/b/1' | |
34 | ||
35 | exit $((failures != 0)) |