• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# This file tests the auxiliary pattern conversion features of the PCRE2
2# library, in non-UTF mode.
3
4#forbid_utf
5#newline_default lf any anycrlf
6
7# -------- Tests of glob conversion --------
8
9# Set the glob separator explicitly so that different OS defaults are not a
10# problem. Then test various errors.
11
12#pattern convert=glob,convert_glob_escape=\,convert_glob_separator=/
13
14/abc/posix
15
16# Separator must be / \ or .
17
18/a*b/convert_glob_separator=%
19
20# Can't have separator in a class
21
22"[ab/cd]"
23
24"[,-/]"
25
26/[ab/
27
28# Length check
29
30/abc/convert_length=11
31
32/abc/convert_length=12
33
34# Now some actual tests
35
36/a?b[]xy]*c/
37    azb]1234c
38
39# Tests from the gitwildmatch list, with some additions
40
41/foo/
42    foo
43/= Expect no match
44    bar
45
46//
47    \
48
49/???/
50    foo
51\= Expect no match
52    foobar
53
54/*/
55    foo
56    \
57
58/f*/
59    foo
60    f
61
62/*f/
63    oof
64\= Expect no match
65    foo
66
67/*foo*/
68    foo
69    food
70    aprilfool
71
72/*ob*a*r*/
73    foobar
74
75/*ab/
76    aaaaaaabababab
77
78/foo\*/
79    foo*
80
81/foo\*bar/
82\= Expect no match
83    foobar
84
85/f\\oo/
86    f\\oo
87
88/*[al]?/
89    ball
90
91/[ten]/
92\= Expect no match
93    ten
94
95/t[a-g]n/
96    ten
97
98/a[]]b/
99    a]b
100
101/a[]a-]b/
102
103/a[]-]b/
104    a-b
105    a]b
106\= Expect no match
107    aab
108
109/a[]a-z]b/
110    aab
111
112/]/
113    ]
114
115/t[!a-g]n/
116    ton
117\= Expect no match
118    ten
119
120'[[:alpha:]][[:digit:]][[:upper:]]'
121    a1B
122
123'[[:digit:][:upper:][:space:]]'
124    A
125    1
126    \ \=
127\= Expect no match
128    a
129    .
130
131'[a-c[:digit:]x-z]'
132    5
133    b
134    y
135\= Expect no match
136    q
137
138# End of gitwildmatch tests
139
140/*.j?g/
141    pic01.jpg
142    .jpg
143    pic02.jxg
144\= Expect no match
145    pic03.j/g
146
147/A[+-0]B/
148    A+B
149    A.B
150    A0B
151\= Expect no match
152    A/B
153
154/*x?z/
155    abc.xyz
156\= Expect no match
157    .xyz
158
159/?x?z/
160    axyz
161\= Expect no match
162    .xyz
163
164"[,-0]x?z"
165    ,xyz
166\= Expect no match
167    /xyz
168    .xyz
169
170".x*"
171    .xabc
172
173/a[--0]z/
174    a-z
175    a.z
176    a0z
177\= Expect no match
178    a/z
179    a1z
180
181/<[a-c-d]>/
182    <a>
183    <b>
184    <c>
185    <d>
186    <->
187
188/a[[:digit:].]z/
189    a1z
190    a.z
191\= Expect no match
192    a:z
193
194/a[[:digit].]z/
195    a[.]z
196    a:.]z
197    ad.]z
198
199/<[[:a[:digit:]b]>/
200    <[>
201    <:>
202    <a>
203    <9>
204    <b>
205\= Expect no match
206    <d>
207
208/a*b/convert_glob_separator=\
209
210/a*b/convert_glob_separator=.
211
212/a*b/convert_glob_separator=/
213
214# Non control character checking
215
216/A\B\\C\D/
217
218/\\{}\?\*+\[\]()|.^$/
219
220/*a*\/*b*/
221
222/?a?\/?b?/
223
224/[a\\b\c][]][-][\]\-]/
225
226/[^a\\b\c][!]][!-][^\]\-]/
227
228/[[:alnum:][:alpha:][:blank:][:cntrl:][:digit:][:graph:][:lower:][:print:][:punct:][:space:][:upper:][:word:][:xdigit:]]/
229
230"[/-/]"
231
232/[-----]/
233
234/[------]/
235
236/[!------]/
237
238/[[:alpha:]-a]/
239
240/[[:alpha:]][[:punct:]][[:ascii:]]/
241
242/[a-[:alpha:]]/
243
244/[[:alpha:/
245
246/[[:alpha:]/
247
248/[[:alphaa:]]/
249
250/[[:xdigi:]]/
251
252/[[:xdigit::]]/
253
254/****/
255
256/**\/abc/
257  abc
258  x/abc
259  xabc
260
261/abc\/**/
262
263/abc\/**\/abc/
264
265/**\/*a*b*g*n*t/
266  abcd/abcdefg/abcdefghijk/abcdefghijklmnop.txt
267
268/**\/*a*\/**/
269  xx/xx/xx/xax/xx/xb
270
271/**\/*a*/
272  xx/xx/xx/xax
273  xx/xx/xx/xax/xx
274
275/**\/*a*\/**\/*b*/
276  xx/xx/xx/xax/xx/xb
277  xx/xx/xx/xax/xx/x
278
279"**a"convert=glob
280  a
281  c/b/a
282  c/b/aaa
283
284"a**/b"convert=glob
285  a/b
286  ab
287
288"a/**b"convert=glob
289  a/b
290  ab
291
292#pattern convert=glob:glob_no_starstar
293
294/***/
295
296/**a**/
297
298#pattern convert=unset
299#pattern convert=glob:glob_no_wild_separator
300
301/*/
302
303/*a*/
304
305/**a**/
306
307/a*b/
308
309/*a*b*/
310
311/??a??/
312
313#pattern convert=unset
314#pattern convert=glob,convert_glob_escape=0
315
316/a\b\cd/
317
318/**\/a/
319
320/a`*b/convert_glob_escape=`
321
322/a`*b/convert_glob_escape=0
323
324/a`*b/convert_glob_escape=x
325
326# -------- Tests of extended POSIX conversion --------
327
328#pattern convert=unset:posix_extended
329
330/<[[:a[:digit:]b]>/
331    <[>
332    <:>
333    <a>
334    <9>
335    <b>
336\= Expect no match
337    <d>
338
339/a+\1b\\c|d[ab\c]/
340
341/<[]bc]>/
342    <]>
343    <b>
344    <c>
345
346/<[^]bc]>/
347    <.>
348\= Expect no match
349    <]>
350    <b>
351
352/(a)\1b/
353    a1b
354\= Expect no match
355    aab
356
357/(ab)c)d]/
358    Xabc)d]Y
359
360/a***b/
361
362# -------- Tests of basic POSIX conversion --------
363
364#pattern convert=unset:posix_basic
365
366/a*b+c\+[def](ab)\(cd\)/
367
368/\(a\)\1b/
369    aab
370\= Expect no match
371    a1b
372
373/how.to how\.to/
374    how\nto how.to
375\= Expect no match
376    how\x{0}to how.to
377
378/^how to \^how to/
379
380/^*abc/
381
382/*abc/
383    X*abcY
384
385/**abc/
386    XabcY
387    X*abcY
388    X**abcY
389
390/*ab\(*cd\)/
391
392/^b\(c^d\)\(^e^f\)/
393
394/a***b/
395
396# End of testinput24
397