3 test_description
='wildmatch tests'
9 test_expect_success
"wildmatch: match '$3' '$4'" "
10 test-wildmatch wildmatch '$3' '$4'
13 test_expect_success
"wildmatch: no match '$3' '$4'" "
14 ! test-wildmatch wildmatch '$3' '$4'
18 test_expect_success
"fnmatch: match '$3' '$4'" "
19 test-wildmatch fnmatch '$3' '$4'
22 test_expect_success
"fnmatch: no match '$3' '$4'" "
23 ! test-wildmatch fnmatch '$3' '$4'
26 # test_expect_success BROKEN_FNMATCH "fnmatch: '$3' '$4'" "
27 # ! test-wildmatch fnmatch '$3' '$4'
32 # Basic wildmat features
42 match
1 1 foobar
'*ob*a*r*'
43 match
1 1 aaaaaaabababab
'*ab'
44 match
1 1 'foo*' 'foo\*'
45 match
0 0 foobar
'foo\*bar'
46 match
1 1 'f\oo' 'f\\oo'
47 match
1 1 ball
'*[al]?'
49 match
1 1 ten
'**[!te]'
50 match
0 0 ten
'**[!ten]'
51 match
1 1 ten
't[a-g]n'
52 match
0 0 ten
't[!a-g]n'
53 match
1 1 ton
't[!a-g]n'
54 match
1 1 ton
't[^a-g]n'
55 match
1 1 'a]b' 'a[]]b'
56 match
1 1 a-b
'a[]-]b'
57 match
1 1 'a]b' 'a[]-]b'
58 match
0 0 aab
'a[]-]b'
59 match
1 1 aab
'a[]a-]b'
62 # Extended slash-matching features
63 match
0 0 'foo/baz/bar' 'foo*bar'
64 match
1 0 'foo/baz/bar' 'foo**bar'
65 match
0 0 'foo/bar' 'foo?bar'
66 match
0 0 'foo/bar' 'foo[/]bar'
67 match
0 0 'foo/bar' 'f[^eiu][^eiu][^eiu][^eiu][^eiu]r'
68 match
1 1 'foo-bar' 'f[^eiu][^eiu][^eiu][^eiu][^eiu]r'
69 match
0 0 'foo' '**/foo'
70 match
1 1 '/foo' '**/foo'
71 match
1 0 'bar/baz/foo' '**/foo'
72 match
0 0 'bar/baz/foo' '*/foo'
73 match
0 0 'foo/bar/baz' '**/bar*'
74 match
1 0 'deep/foo/bar/baz' '**/bar/*'
75 match
0 0 'deep/foo/bar/baz/' '**/bar/*'
76 match
1 0 'deep/foo/bar/baz/' '**/bar/**'
77 match
0 0 'deep/foo/bar' '**/bar/*'
78 match
1 0 'deep/foo/bar/' '**/bar/**'
79 match
1 0 'foo/bar/baz' '**/bar**'
80 match
1 0 'foo/bar/baz/x' '*/bar/**'
81 match
0 0 'deep/foo/bar/baz/x' '*/bar/**'
82 match
1 0 'deep/foo/bar/baz/x' '**/bar/*/*'
84 # Various additional tests
85 match
0 0 'acrt' 'a[c-c]st'
86 match
1 1 'acrt' 'a[c-c]rt'
94 match
1 1 '@foo' '@foo'
95 match
0 0 'foo' '@foo'
96 match
1 1 '[ab]' '\[ab]'
97 match
1 1 '[ab]' '[[]ab]'
98 match
1 1 '[ab]' '[[:]ab]'
99 match
0 0 '[ab]' '[[::]ab]'
100 match
1 1 '[ab]' '[[:digit]ab]'
101 match
1 1 '[ab]' '[\[:]ab]'
102 match
1 1 '?a?b' '\??\?b'
103 match
1 1 'abc' '\a\b\c'
105 match
1 0 'foo/bar/baz/to' '**/t[o]'
107 # Character class tests
108 match
1 1 'a1B' '[[:alpha:]][[:digit:]][[:upper:]]'
109 match
0 0 'a' '[[:digit:][:upper:][:space:]]'
110 match
1 1 'A' '[[:digit:][:upper:][:space:]]'
111 match
1 0 '1' '[[:digit:][:upper:][:space:]]'
112 match
0 0 '1' '[[:digit:][:upper:][:spaci:]]'
113 match
1 1 ' ' '[[:digit:][:upper:][:space:]]'
114 match
0 0 '.' '[[:digit:][:upper:][:space:]]'
115 match
1 1 '.' '[[:digit:][:punct:][:space:]]'
116 match
1 1 '5' '[[:xdigit:]]'
117 match
1 1 'f' '[[:xdigit:]]'
118 match
1 1 'D' '[[:xdigit:]]'
119 match
1 0 '_' '[[:alnum:][:alpha:][:blank:][:cntrl:][:digit:][:graph:][:lower:][:print:][:punct:][:space:][:upper:][:xdigit:]]'
120 match
1 0 '_' '[[:alnum:][:alpha:][:blank:][:cntrl:][:digit:][:graph:][:lower:][:print:][:punct:][:space:][:upper:][:xdigit:]]'
121 match
1 1 '.' '[^[:alnum:][:alpha:][:blank:][:cntrl:][:digit:][:lower:][:space:][:upper:][:xdigit:]]'
122 match
1 1 '5' '[a-c[:digit:]x-z]'
123 match
1 1 'b' '[a-c[:digit:]x-z]'
124 match
1 1 'y' '[a-c[:digit:]x-z]'
125 match
0 0 'q' '[a-c[:digit:]x-z]'
127 # Additional tests, including some malformed wildmats
128 match
1 1 ']' '[\\-^]'
129 match
0 0 '[' '[\\-^]'
130 match
1 1 '-' '[\-_]'
132 match
0 0 '\]' '[\]]'
134 match 0 0 'ab
' 'a
[]b
'
135 match 0 1 'a
[]b
' 'a
[]b
'
136 match 0 1 'ab
[' 'ab
['
142 match 1 1 '-' '[--A]'
143 match 1 1 '5' '[--A]'
144 match 1 1 ' ' '[ --]'
145 match 1 1 '$
' '[ --]'
146 match 1 1 '-' '[ --]'
147 match 0 0 '0' '[ --]'
148 match 1 1 '-' '[---]'
149 match 1 1 '-' '[------]'
150 match 0 0 'j
' '[a-e-n
]'
151 match 1 1 '-' '[a-e-n
]'
152 match 1 1 'a
' '[!------]'
153 match 0 0 '[' '[]-a]'
154 match 1 1 '^
' '[]-a]'
155 match 0 0 '^
' '[!]-a]'
156 match 1 1 '[' '[!]-a]'
157 match 1 1 '^
' '[a^
bc]'
158 match 1 1 '-b]' '[a-
]b
]'
161 match 0 0 '\' '[!\\]'
162 match
1 1 'G' '[A-\\]'
163 match
0 0 'aaabbb' 'b*a'
164 match
0 0 'aabcaa' '*ba*'
166 match
1 1 ',' '[\\,]'
167 match
1 1 '\' '[\\,]'
168 match 1 1 '-' '[,-.
]'
169 match 0 0 '+' '[,-.
]'
170 match 0 0 '-.
]' '[,-.
]'
171 match 1 1 '2' '[\
1-\
3]'
172 match 1 1 '3' '[\
1-\
3]'
173 match 0 0 '4' '[\
1-\
3]'
174 match 1 1 '\' '[[-\]]'
175 match
1 1 '[' '[[-\]]'
176 match
1 1 ']' '[[-\]]'
177 match
0 0 '-' '[[-\]]'
179 # Test recursion and the abort code (use "wildtest -i" to see iteration counts)
180 match
1 1 '-adobe-courier-bold-o-normal--12-120-75-75-m-70-iso8859-1' '-*-*-*-*-*-*-12-*-*-*-m-*-*-*'
181 match
0 0 '-adobe-courier-bold-o-normal--12-120-75-75-X-70-iso8859-1' '-*-*-*-*-*-*-12-*-*-*-m-*-*-*'
182 match
0 0 '-adobe-courier-bold-o-normal--12-120-75-75-/-70-iso8859-1' '-*-*-*-*-*-*-12-*-*-*-m-*-*-*'
183 match
1 1 '/adobe/courier/bold/o/normal//12/120/75/75/m/70/iso8859/1' '/*/*/*/*/*/*/12/*/*/*/m/*/*/*'
184 match
0 0 '/adobe/courier/bold/o/normal//12/120/75/75/X/70/iso8859/1' '/*/*/*/*/*/*/12/*/*/*/m/*/*/*'
185 match
1 0 'abcd/abcdefg/abcdefghijk/abcdefghijklmnop.txt' '**/*a*b*g*n*t'
186 match
0 0 'abcd/abcdefg/abcdefghijk/abcdefghijklmnop.txtz' '**/*a*b*g*n*t'