wildmatch test: perform all tests under all wildmatch() modes

Rewrite the wildmatch() test suite so that each test now tests all combinations of the wildmatch() WM_CASEFOLD and WM_PATHNAME flags. Before this change some test inputs were not tested on e.g. WM_PATHNAME. Now the function is stress tested on all possible inputs, and for each input we declare what the result should be if the mode is case-insensitive, or pathname matching, or case-sensitive or not matching pathnames. Also before this change, nothing was testing case-insensitive non-pathname matching, so I've added that to test-wildmatch.c and made use of it. This yields a rather scary patch, but there are no functional changes here, just more test coverage. Some now-redundant tests were deleted as a result of this change, since they were now duplicating an earlier test. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed Jan 30, 2018 at 21:21 UTC 91061c444a245b967a97b84b01a11bbe077c3477
2 files changed +228 -252
t/helper/test-wildmatch.c
+2
@@ -16,6 +16,8 @@ int cmd_main(int argc, const char **argv)
16 return !!wildmatch(argv[3], argv[2], WM_PATHNAME | WM_CASEFOLD);
17 else if (!strcmp(argv[1], "pathmatch"))
18 return !!wildmatch(argv[3], argv[2], 0);
19 + else if (!strcmp(argv[1], "ipathmatch"))
20 + return !!wildmatch(argv[3], argv[2], WM_CASEFOLD);
21 else
22 return 1;
23 }
t/t3070-wildmatch.sh
+226 -252
@@ -4,278 +4,252 @@ test_description='wildmatch tests'
4
5 . ./test-lib.sh
6
7 -match() {
8 - if test "$1" = 1
9 - then
10 - test_expect_success "wildmatch: match '$2' '$3'" "
11 - test-wildmatch wildmatch '$2' '$3'
12 - "
13 - elif test "$1" = 0
14 - then
15 - test_expect_success "wildmatch: no match '$2' '$3'" "
16 - test_must_fail test-wildmatch wildmatch '$2' '$3'
17 - "
18 - else
19 - test_expect_success "PANIC: Test framework error. Unknown matches value $1" 'false'
20 - fi
21 -}
7 +match_with_function() {
8 + text=$1
9 + pattern=$2
10 + match_expect=$3
11 + match_function=$4
12
23 -imatch() {
24 - if test "$1" = 1
13 + if test "$match_expect" = 1
14 then
26 - test_expect_success "iwildmatch: match '$2' '$3'" "
27 - test-wildmatch iwildmatch '$2' '$3'
15 + test_expect_success "$match_function: match '$text' '$pattern'" "
16 + test-wildmatch $match_function '$text' '$pattern'
17 "
29 - elif test "$1" = 0
18 + elif test "$match_expect" = 0
19 then
31 - test_expect_success "iwildmatch: no match '$2' '$3'" "
32 - test_must_fail test-wildmatch iwildmatch '$2' '$3'
20 + test_expect_success "$match_function: no match '$text' '$pattern'" "
21 + test_must_fail test-wildmatch $match_function '$text' '$pattern'
22 "
23 else
35 - test_expect_success "PANIC: Test framework error. Unknown matches value $1" 'false'
24 + test_expect_success "PANIC: Test framework error. Unknown matches value $match_expect" 'false'
25 fi
26 +
27 }
28
39 -pathmatch() {
40 - if test "$1" = 1
41 - then
42 - test_expect_success "pathmatch: match '$2' '$3'" "
43 - test-wildmatch pathmatch '$2' '$3'
44 - "
45 - elif test "$1" = 0
46 - then
47 - test_expect_success "pathmatch: no match '$2' '$3'" "
48 - test_must_fail test-wildmatch pathmatch '$2' '$3'
49 - "
50 - else
51 - test_expect_success "PANIC: Test framework error. Unknown matches value $1" 'false'
52 - fi
29 +match() {
30 + match_glob=$1
31 + match_iglob=$2
32 + match_pathmatch=$3
33 + match_pathmatchi=$4
34 + text=$5
35 + pattern=$6
36 +
37 + # $1: Case sensitive glob match: test-wildmatch & ls-files
38 + match_with_function "$text" "$pattern" $match_glob "wildmatch"
39 +
40 + # $2: Case insensitive glob match: test-wildmatch & ls-files
41 + match_with_function "$text" "$pattern" $match_iglob "iwildmatch"
42 +
43 + # $3: Case sensitive path match: test-wildmatch & ls-files
44 + match_with_function "$text" "$pattern" $match_pathmatch "pathmatch"
45 +
46 + # $4: Case insensitive path match: test-wildmatch & ls-files
47 + match_with_function "$text" "$pattern" $match_pathmatchi "ipathmatch"
48 }
49
55 -# Basic wildmat features
56 -match 1 foo foo
57 -match 0 foo bar
58 -match 1 '' ""
59 -match 1 foo '???'
60 -match 0 foo '??'
61 -match 1 foo '*'
62 -match 1 foo 'f*'
63 -match 0 foo '*f'
64 -match 1 foo '*foo*'
65 -match 1 foobar '*ob*a*r*'
66 -match 1 aaaaaaabababab '*ab'
67 -match 1 'foo*' 'foo\*'
68 -match 0 foobar 'foo\*bar'
69 -match 1 'f\oo' 'f\\oo'
70 -match 1 ball '*[al]?'
71 -match 0 ten '[ten]'
72 -match 0 ten '**[!te]'
73 -match 0 ten '**[!ten]'
74 -match 1 ten 't[a-g]n'
75 -match 0 ten 't[!a-g]n'
76 -match 1 ton 't[!a-g]n'
77 -match 1 ton 't[^a-g]n'
78 -match 1 'a]b' 'a[]]b'
79 -match 1 a-b 'a[]-]b'
80 -match 1 'a]b' 'a[]-]b'
81 -match 0 aab 'a[]-]b'
82 -match 1 aab 'a[]a-]b'
83 -match 1 ']' ']'
50 +# Basic wildmatch features
51 +match 1 1 1 1 foo foo
52 +match 0 0 0 0 foo bar
53 +match 1 1 1 1 '' ""
54 +match 1 1 1 1 foo '???'
55 +match 0 0 0 0 foo '??'
56 +match 1 1 1 1 foo '*'
57 +match 1 1 1 1 foo 'f*'
58 +match 0 0 0 0 foo '*f'
59 +match 1 1 1 1 foo '*foo*'
60 +match 1 1 1 1 foobar '*ob*a*r*'
61 +match 1 1 1 1 aaaaaaabababab '*ab'
62 +match 1 1 1 1 'foo*' 'foo\*'
63 +match 0 0 0 0 foobar 'foo\*bar'
64 +match 1 1 1 1 'f\oo' 'f\\oo'
65 +match 1 1 1 1 ball '*[al]?'
66 +match 0 0 0 0 ten '[ten]'
67 +match 0 0 1 1 ten '**[!te]'
68 +match 0 0 0 0 ten '**[!ten]'
69 +match 1 1 1 1 ten 't[a-g]n'
70 +match 0 0 0 0 ten 't[!a-g]n'
71 +match 1 1 1 1 ton 't[!a-g]n'
72 +match 1 1 1 1 ton 't[^a-g]n'
73 +match 1 1 1 1 'a]b' 'a[]]b'
74 +match 1 1 1 1 a-b 'a[]-]b'
75 +match 1 1 1 1 'a]b' 'a[]-]b'
76 +match 0 0 0 0 aab 'a[]-]b'
77 +match 1 1 1 1 aab 'a[]a-]b'
78 +match 1 1 1 1 ']' ']'
79
80 # Extended slash-matching features
86 -match 0 'foo/baz/bar' 'foo*bar'
87 -match 0 'foo/baz/bar' 'foo**bar'
88 -match 0 'foobazbar' 'foo**bar'
89 -match 1 'foo/baz/bar' 'foo/**/bar'
90 -match 1 'foo/baz/bar' 'foo/**/**/bar'
91 -match 1 'foo/b/a/z/bar' 'foo/**/bar'
92 -match 1 'foo/b/a/z/bar' 'foo/**/**/bar'
93 -match 1 'foo/bar' 'foo/**/bar'
94 -match 1 'foo/bar' 'foo/**/**/bar'
95 -match 0 'foo/bar' 'foo?bar'
96 -match 0 'foo/bar' 'foo[/]bar'
97 -match 0 'foo/bar' 'foo[^a-z]bar'
98 -match 0 'foo/bar' 'f[^eiu][^eiu][^eiu][^eiu][^eiu]r'
99 -match 1 'foo-bar' 'f[^eiu][^eiu][^eiu][^eiu][^eiu]r'
100 -match 1 'foo' '**/foo'
101 -match 1 'XXX/foo' '**/foo'
102 -match 1 'bar/baz/foo' '**/foo'
103 -match 0 'bar/baz/foo' '*/foo'
104 -match 0 'foo/bar/baz' '**/bar*'
105 -match 1 'deep/foo/bar/baz' '**/bar/*'
106 -match 0 'deep/foo/bar/baz/' '**/bar/*'
107 -match 1 'deep/foo/bar/baz/' '**/bar/**'
108 -match 0 'deep/foo/bar' '**/bar/*'
109 -match 1 'deep/foo/bar/' '**/bar/**'
110 -match 0 'foo/bar/baz' '**/bar**'
111 -match 1 'foo/bar/baz/x' '*/bar/**'
112 -match 0 'deep/foo/bar/baz/x' '*/bar/**'
113 -match 1 'deep/foo/bar/baz/x' '**/bar/*/*'
81 +match 0 0 1 1 'foo/baz/bar' 'foo*bar'
82 +match 0 0 1 1 'foo/baz/bar' 'foo**bar'
83 +match 0 0 1 1 'foobazbar' 'foo**bar'
84 +match 1 1 1 1 'foo/baz/bar' 'foo/**/bar'
85 +match 1 1 0 0 'foo/baz/bar' 'foo/**/**/bar'
86 +match 1 1 1 1 'foo/b/a/z/bar' 'foo/**/bar'
87 +match 1 1 1 1 'foo/b/a/z/bar' 'foo/**/**/bar'
88 +match 1 1 0 0 'foo/bar' 'foo/**/bar'
89 +match 1 1 0 0 'foo/bar' 'foo/**/**/bar'
90 +match 0 0 1 1 'foo/bar' 'foo?bar'
91 +match 0 0 1 1 'foo/bar' 'foo[/]bar'
92 +match 0 0 1 1 'foo/bar' 'foo[^a-z]bar'
93 +match 0 0 1 1 'foo/bar' 'f[^eiu][^eiu][^eiu][^eiu][^eiu]r'
94 +match 1 1 1 1 'foo-bar' 'f[^eiu][^eiu][^eiu][^eiu][^eiu]r'
95 +match 1 1 0 0 'foo' '**/foo'
96 +match 1 1 1 1 'XXX/foo' '**/foo'
97 +match 1 1 1 1 'bar/baz/foo' '**/foo'
98 +match 0 0 1 1 'bar/baz/foo' '*/foo'
99 +match 0 0 1 1 'foo/bar/baz' '**/bar*'
100 +match 1 1 1 1 'deep/foo/bar/baz' '**/bar/*'
101 +match 0 0 1 1 'deep/foo/bar/baz/' '**/bar/*'
102 +match 1 1 1 1 'deep/foo/bar/baz/' '**/bar/**'
103 +match 0 0 0 0 'deep/foo/bar' '**/bar/*'
104 +match 1 1 1 1 'deep/foo/bar/' '**/bar/**'
105 +match 0 0 1 1 'foo/bar/baz' '**/bar**'
106 +match 1 1 1 1 'foo/bar/baz/x' '*/bar/**'
107 +match 0 0 1 1 'deep/foo/bar/baz/x' '*/bar/**'
108 +match 1 1 1 1 'deep/foo/bar/baz/x' '**/bar/*/*'
109
110 # Various additional tests
116 -match 0 'acrt' 'a[c-c]st'
117 -match 1 'acrt' 'a[c-c]rt'
118 -match 0 ']' '[!]-]'
119 -match 1 'a' '[!]-]'
120 -match 0 '' '\'
121 -match 0 '\' '\'
122 -match 0 'XXX/\' '*/\'
123 -match 1 'XXX/\' '*/\\'
124 -match 1 'foo' 'foo'
125 -match 1 '@foo' '@foo'
126 -match 0 'foo' '@foo'
127 -match 1 '[ab]' '\[ab]'
128 -match 1 '[ab]' '[[]ab]'
129 -match 1 '[ab]' '[[:]ab]'
130 -match 0 '[ab]' '[[::]ab]'
131 -match 1 '[ab]' '[[:digit]ab]'
132 -match 1 '[ab]' '[\[:]ab]'
133 -match 1 '?a?b' '\??\?b'
134 -match 1 'abc' '\a\b\c'
135 -match 0 'foo' ''
136 -match 1 'foo/bar/baz/to' '**/t[o]'
111 +match 0 0 0 0 'acrt' 'a[c-c]st'
112 +match 1 1 1 1 'acrt' 'a[c-c]rt'
113 +match 0 0 0 0 ']' '[!]-]'
114 +match 1 1 1 1 'a' '[!]-]'
115 +match 0 0 0 0 '' '\'
116 +match 0 0 0 0 '\' '\'
117 +match 0 0 0 0 'XXX/\' '*/\'
118 +match 1 1 1 1 'XXX/\' '*/\\'
119 +match 1 1 1 1 'foo' 'foo'
120 +match 1 1 1 1 '@foo' '@foo'
121 +match 0 0 0 0 'foo' '@foo'
122 +match 1 1 1 1 '[ab]' '\[ab]'
123 +match 1 1 1 1 '[ab]' '[[]ab]'
124 +match 1 1 1 1 '[ab]' '[[:]ab]'
125 +match 0 0 0 0 '[ab]' '[[::]ab]'
126 +match 1 1 1 1 '[ab]' '[[:digit]ab]'
127 +match 1 1 1 1 '[ab]' '[\[:]ab]'
128 +match 1 1 1 1 '?a?b' '\??\?b'
129 +match 1 1 1 1 'abc' '\a\b\c'
130 +match 0 0 0 0 'foo' ''
131 +match 1 1 1 1 'foo/bar/baz/to' '**/t[o]'
132
133 # Character class tests
139 -match 1 'a1B' '[[:alpha:]][[:digit:]][[:upper:]]'
140 -match 0 'a' '[[:digit:][:upper:][:space:]]'
141 -match 1 'A' '[[:digit:][:upper:][:space:]]'
142 -match 1 '1' '[[:digit:][:upper:][:space:]]'
143 -match 0 '1' '[[:digit:][:upper:][:spaci:]]'
144 -match 1 ' ' '[[:digit:][:upper:][:space:]]'
145 -match 0 '.' '[[:digit:][:upper:][:space:]]'
146 -match 1 '.' '[[:digit:][:punct:][:space:]]'
147 -match 1 '5' '[[:xdigit:]]'
148 -match 1 'f' '[[:xdigit:]]'
149 -match 1 'D' '[[:xdigit:]]'
150 -match 1 '_' '[[:alnum:][:alpha:][:blank:][:cntrl:][:digit:][:graph:][:lower:][:print:][:punct:][:space:][:upper:][:xdigit:]]'
151 -match 1 '.' '[^[:alnum:][:alpha:][:blank:][:cntrl:][:digit:][:lower:][:space:][:upper:][:xdigit:]]'
152 -match 1 '5' '[a-c[:digit:]x-z]'
153 -match 1 'b' '[a-c[:digit:]x-z]'
154 -match 1 'y' '[a-c[:digit:]x-z]'
155 -match 0 'q' '[a-c[:digit:]x-z]'
156 -
157 -# Additional tests, including some malformed wildmats
158 -match 1 ']' '[\\-^]'
159 -match 0 '[' '[\\-^]'
160 -match 1 '-' '[\-_]'
161 -match 1 ']' '[\]]'
162 -match 0 '\]' '[\]]'
163 -match 0 '\' '[\]]'
164 -match 0 'ab' 'a[]b'
165 -match 0 'a[]b' 'a[]b'
166 -match 0 'ab[' 'ab['
167 -match 0 'ab' '[!'
168 -match 0 'ab' '[-'
169 -match 1 '-' '[-]'
170 -match 0 '-' '[a-'
171 -match 0 '-' '[!a-'
172 -match 1 '-' '[--A]'
173 -match 1 '5' '[--A]'
174 -match 1 ' ' '[ --]'
175 -match 1 '$' '[ --]'
176 -match 1 '-' '[ --]'
177 -match 0 '0' '[ --]'
178 -match 1 '-' '[---]'
179 -match 1 '-' '[------]'
180 -match 0 'j' '[a-e-n]'
181 -match 1 '-' '[a-e-n]'
182 -match 1 'a' '[!------]'
183 -match 0 '[' '[]-a]'
184 -match 1 '^' '[]-a]'
185 -match 0 '^' '[!]-a]'
186 -match 1 '[' '[!]-a]'
187 -match 1 '^' '[a^bc]'
188 -match 1 '-b]' '[a-]b]'
189 -match 0 '\' '[\]'
190 -match 1 '\' '[\\]'
191 -match 0 '\' '[!\\]'
192 -match 1 'G' '[A-\\]'
193 -match 0 'aaabbb' 'b*a'
194 -match 0 'aabcaa' '*ba*'
195 -match 1 ',' '[,]'
196 -match 1 ',' '[\\,]'
197 -match 1 '\' '[\\,]'
198 -match 1 '-' '[,-.]'
199 -match 0 '+' '[,-.]'
200 -match 0 '-.]' '[,-.]'
201 -match 1 '2' '[\1-\3]'
202 -match 1 '3' '[\1-\3]'
203 -match 0 '4' '[\1-\3]'
204 -match 1 '\' '[[-\]]'
205 -match 1 '[' '[[-\]]'
206 -match 1 ']' '[[-\]]'
207 -match 0 '-' '[[-\]]'
134 +match 1 1 1 1 'a1B' '[[:alpha:]][[:digit:]][[:upper:]]'
135 +match 0 1 0 1 'a' '[[:digit:][:upper:][:space:]]'
136 +match 1 1 1 1 'A' '[[:digit:][:upper:][:space:]]'
137 +match 1 1 1 1 '1' '[[:digit:][:upper:][:space:]]'
138 +match 0 0 0 0 '1' '[[:digit:][:upper:][:spaci:]]'
139 +match 1 1 1 1 ' ' '[[:digit:][:upper:][:space:]]'
140 +match 0 0 0 0 '.' '[[:digit:][:upper:][:space:]]'
141 +match 1 1 1 1 '.' '[[:digit:][:punct:][:space:]]'
142 +match 1 1 1 1 '5' '[[:xdigit:]]'
143 +match 1 1 1 1 'f' '[[:xdigit:]]'
144 +match 1 1 1 1 'D' '[[:xdigit:]]'
145 +match 1 1 1 1 '_' '[[:alnum:][:alpha:][:blank:][:cntrl:][:digit:][:graph:][:lower:][:print:][:punct:][:space:][:upper:][:xdigit:]]'
146 +match 1 1 1 1 '.' '[^[:alnum:][:alpha:][:blank:][:cntrl:][:digit:][:lower:][:space:][:upper:][:xdigit:]]'
147 +match 1 1 1 1 '5' '[a-c[:digit:]x-z]'
148 +match 1 1 1 1 'b' '[a-c[:digit:]x-z]'
149 +match 1 1 1 1 'y' '[a-c[:digit:]x-z]'
150 +match 0 0 0 0 'q' '[a-c[:digit:]x-z]'
151
209 -# Test recursion and the abort code (use "wildtest -i" to see iteration counts)
210 -match 1 '-adobe-courier-bold-o-normal--12-120-75-75-m-70-iso8859-1' '-*-*-*-*-*-*-12-*-*-*-m-*-*-*'
211 -match 0 '-adobe-courier-bold-o-normal--12-120-75-75-X-70-iso8859-1' '-*-*-*-*-*-*-12-*-*-*-m-*-*-*'
212 -match 0 '-adobe-courier-bold-o-normal--12-120-75-75-/-70-iso8859-1' '-*-*-*-*-*-*-12-*-*-*-m-*-*-*'
213 -match 1 'XXX/adobe/courier/bold/o/normal//12/120/75/75/m/70/iso8859/1' 'XXX/*/*/*/*/*/*/12/*/*/*/m/*/*/*'
214 -match 0 'XXX/adobe/courier/bold/o/normal//12/120/75/75/X/70/iso8859/1' 'XXX/*/*/*/*/*/*/12/*/*/*/m/*/*/*'
215 -match 1 'abcd/abcdefg/abcdefghijk/abcdefghijklmnop.txt' '**/*a*b*g*n*t'
216 -match 0 'abcd/abcdefg/abcdefghijk/abcdefghijklmnop.txtz' '**/*a*b*g*n*t'
217 -match 0 foo '*/*/*'
218 -match 0 foo/bar '*/*/*'
219 -match 1 foo/bba/arr '*/*/*'
220 -match 0 foo/bb/aa/rr '*/*/*'
221 -match 1 foo/bb/aa/rr '**/**/**'
222 -match 1 abcXdefXghi '*X*i'
223 -match 0 ab/cXd/efXg/hi '*X*i'
224 -match 1 ab/cXd/efXg/hi '*/*X*/*/*i'
225 -match 1 ab/cXd/efXg/hi '**/*X*/**/*i'
152 +# Additional tests, including some malformed wildmatch patterns
153 +match 1 1 1 1 ']' '[\\-^]'
154 +match 0 0 0 0 '[' '[\\-^]'
155 +match 1 1 1 1 '-' '[\-_]'
156 +match 1 1 1 1 ']' '[\]]'
157 +match 0 0 0 0 '\]' '[\]]'
158 +match 0 0 0 0 '\' '[\]]'
159 +match 0 0 0 0 'ab' 'a[]b'
160 +match 0 0 0 0 'a[]b' 'a[]b'
161 +match 0 0 0 0 'ab[' 'ab['
162 +match 0 0 0 0 'ab' '[!'
163 +match 0 0 0 0 'ab' '[-'
164 +match 1 1 1 1 '-' '[-]'
165 +match 0 0 0 0 '-' '[a-'
166 +match 0 0 0 0 '-' '[!a-'
167 +match 1 1 1 1 '-' '[--A]'
168 +match 1 1 1 1 '5' '[--A]'
169 +match 1 1 1 1 ' ' '[ --]'
170 +match 1 1 1 1 '$' '[ --]'
171 +match 1 1 1 1 '-' '[ --]'
172 +match 0 0 0 0 '0' '[ --]'
173 +match 1 1 1 1 '-' '[---]'
174 +match 1 1 1 1 '-' '[------]'
175 +match 0 0 0 0 'j' '[a-e-n]'
176 +match 1 1 1 1 '-' '[a-e-n]'
177 +match 1 1 1 1 'a' '[!------]'
178 +match 0 0 0 0 '[' '[]-a]'
179 +match 1 1 1 1 '^' '[]-a]'
180 +match 0 0 0 0 '^' '[!]-a]'
181 +match 1 1 1 1 '[' '[!]-a]'
182 +match 1 1 1 1 '^' '[a^bc]'
183 +match 1 1 1 1 '-b]' '[a-]b]'
184 +match 0 0 0 0 '\' '[\]'
185 +match 1 1 1 1 '\' '[\\]'
186 +match 0 0 0 0 '\' '[!\\]'
187 +match 1 1 1 1 'G' '[A-\\]'
188 +match 0 0 0 0 'aaabbb' 'b*a'
189 +match 0 0 0 0 'aabcaa' '*ba*'
190 +match 1 1 1 1 ',' '[,]'
191 +match 1 1 1 1 ',' '[\\,]'
192 +match 1 1 1 1 '\' '[\\,]'
193 +match 1 1 1 1 '-' '[,-.]'
194 +match 0 0 0 0 '+' '[,-.]'
195 +match 0 0 0 0 '-.]' '[,-.]'
196 +match 1 1 1 1 '2' '[\1-\3]'
197 +match 1 1 1 1 '3' '[\1-\3]'
198 +match 0 0 0 0 '4' '[\1-\3]'
199 +match 1 1 1 1 '\' '[[-\]]'
200 +match 1 1 1 1 '[' '[[-\]]'
201 +match 1 1 1 1 ']' '[[-\]]'
202 +match 0 0 0 0 '-' '[[-\]]'
203
227 -pathmatch 1 foo foo
228 -pathmatch 0 foo fo
229 -pathmatch 1 foo/bar foo/bar
230 -pathmatch 1 foo/bar 'foo/*'
231 -pathmatch 1 foo/bba/arr 'foo/*'
232 -pathmatch 1 foo/bba/arr 'foo/**'
233 -pathmatch 1 foo/bba/arr 'foo*'
234 -pathmatch 1 foo/bba/arr 'foo**'
235 -pathmatch 1 foo/bba/arr 'foo/*arr'
236 -pathmatch 1 foo/bba/arr 'foo/**arr'
237 -pathmatch 0 foo/bba/arr 'foo/*z'
238 -pathmatch 0 foo/bba/arr 'foo/**z'
239 -pathmatch 1 foo/bar 'foo?bar'
240 -pathmatch 1 foo/bar 'foo[/]bar'
241 -pathmatch 1 foo/bar 'foo[^a-z]bar'
242 -pathmatch 0 foo '*/*/*'
243 -pathmatch 0 foo/bar '*/*/*'
244 -pathmatch 1 foo/bba/arr '*/*/*'
245 -pathmatch 1 foo/bb/aa/rr '*/*/*'
246 -pathmatch 1 abcXdefXghi '*X*i'
247 -pathmatch 1 ab/cXd/efXg/hi '*/*X*/*/*i'
248 -pathmatch 1 ab/cXd/efXg/hi '*Xg*i'
204 +# Test recursion
205 +match 1 1 1 1 '-adobe-courier-bold-o-normal--12-120-75-75-m-70-iso8859-1' '-*-*-*-*-*-*-12-*-*-*-m-*-*-*'
206 +match 0 0 0 0 '-adobe-courier-bold-o-normal--12-120-75-75-X-70-iso8859-1' '-*-*-*-*-*-*-12-*-*-*-m-*-*-*'
207 +match 0 0 0 0 '-adobe-courier-bold-o-normal--12-120-75-75-/-70-iso8859-1' '-*-*-*-*-*-*-12-*-*-*-m-*-*-*'
208 +match 1 1 1 1 'XXX/adobe/courier/bold/o/normal//12/120/75/75/m/70/iso8859/1' 'XXX/*/*/*/*/*/*/12/*/*/*/m/*/*/*'
209 +match 0 0 0 0 'XXX/adobe/courier/bold/o/normal//12/120/75/75/X/70/iso8859/1' 'XXX/*/*/*/*/*/*/12/*/*/*/m/*/*/*'
210 +match 1 1 1 1 'abcd/abcdefg/abcdefghijk/abcdefghijklmnop.txt' '**/*a*b*g*n*t'
211 +match 0 0 0 0 'abcd/abcdefg/abcdefghijk/abcdefghijklmnop.txtz' '**/*a*b*g*n*t'
212 +match 0 0 0 0 foo '*/*/*'
213 +match 0 0 0 0 foo/bar '*/*/*'
214 +match 1 1 1 1 foo/bba/arr '*/*/*'
215 +match 0 0 1 1 foo/bb/aa/rr '*/*/*'
216 +match 1 1 1 1 foo/bb/aa/rr '**/**/**'
217 +match 1 1 1 1 abcXdefXghi '*X*i'
218 +match 0 0 1 1 ab/cXd/efXg/hi '*X*i'
219 +match 1 1 1 1 ab/cXd/efXg/hi '*/*X*/*/*i'
220 +match 1 1 1 1 ab/cXd/efXg/hi '**/*X*/**/*i'
221
250 -# Case-sensitivity features
251 -match 0 'a' '[A-Z]'
252 -match 1 'A' '[A-Z]'
253 -match 0 'A' '[a-z]'
254 -match 1 'a' '[a-z]'
255 -match 0 'a' '[[:upper:]]'
256 -match 1 'A' '[[:upper:]]'
257 -match 0 'A' '[[:lower:]]'
258 -match 1 'a' '[[:lower:]]'
259 -match 0 'A' '[B-Za]'
260 -match 1 'a' '[B-Za]'
261 -match 0 'A' '[B-a]'
262 -match 1 'a' '[B-a]'
263 -match 0 'z' '[Z-y]'
264 -match 1 'Z' '[Z-y]'
222 +# Extra pathmatch tests
223 +match 0 0 0 0 foo fo
224 +match 1 1 1 1 foo/bar foo/bar
225 +match 1 1 1 1 foo/bar 'foo/*'
226 +match 0 0 1 1 foo/bba/arr 'foo/*'
227 +match 1 1 1 1 foo/bba/arr 'foo/**'
228 +match 0 0 1 1 foo/bba/arr 'foo*'
229 +match 0 0 1 1 foo/bba/arr 'foo**'
230 +match 0 0 1 1 foo/bba/arr 'foo/*arr'
231 +match 0 0 1 1 foo/bba/arr 'foo/**arr'
232 +match 0 0 0 0 foo/bba/arr 'foo/*z'
233 +match 0 0 0 0 foo/bba/arr 'foo/**z'
234 +match 0 0 1 1 foo/bar 'foo?bar'
235 +match 0 0 1 1 foo/bar 'foo[/]bar'
236 +match 0 0 1 1 foo/bar 'foo[^a-z]bar'
237 +match 0 0 1 1 ab/cXd/efXg/hi '*Xg*i'
238
266 -imatch 1 'a' '[A-Z]'
267 -imatch 1 'A' '[A-Z]'
268 -imatch 1 'A' '[a-z]'
269 -imatch 1 'a' '[a-z]'
270 -imatch 1 'a' '[[:upper:]]'
271 -imatch 1 'A' '[[:upper:]]'
272 -imatch 1 'A' '[[:lower:]]'
273 -imatch 1 'a' '[[:lower:]]'
274 -imatch 1 'A' '[B-Za]'
275 -imatch 1 'a' '[B-Za]'
276 -imatch 1 'A' '[B-a]'
277 -imatch 1 'a' '[B-a]'
278 -imatch 1 'z' '[Z-y]'
279 -imatch 1 'Z' '[Z-y]'
239 +# Extra case-sensitivity tests
240 +match 0 1 0 1 'a' '[A-Z]'
241 +match 1 1 1 1 'A' '[A-Z]'
242 +match 0 1 0 1 'A' '[a-z]'
243 +match 1 1 1 1 'a' '[a-z]'
244 +match 0 1 0 1 'a' '[[:upper:]]'
245 +match 1 1 1 1 'A' '[[:upper:]]'
246 +match 0 1 0 1 'A' '[[:lower:]]'
247 +match 1 1 1 1 'a' '[[:lower:]]'
248 +match 0 1 0 1 'A' '[B-Za]'
249 +match 1 1 1 1 'a' '[B-Za]'
250 +match 0 1 0 1 'A' '[B-a]'
251 +match 1 1 1 1 'a' '[B-a]'
252 +match 0 1 0 1 'z' '[Z-y]'
253 +match 1 1 1 1 'Z' '[Z-y]'
254
255 test_done