2017-05-06 18:19:39 +02:00
|
|
|
# This file tests the auxiliary pattern conversion features of the PCRE2
|
|
|
|
# library, in non-UTF mode.
|
|
|
|
|
|
|
|
#forbid_utf
|
|
|
|
#newline_default lf any anycrlf
|
|
|
|
|
|
|
|
# -------- Tests of glob conversion --------
|
|
|
|
|
|
|
|
# Set the glob separator explicitly so that different OS defaults are not a
|
|
|
|
# problem. Then test various errors.
|
|
|
|
|
2017-06-24 17:54:14 +02:00
|
|
|
#pattern convert=glob,convert_glob_escape=\,convert_glob_separator=/
|
2017-05-06 18:19:39 +02:00
|
|
|
|
|
|
|
/abc/posix
|
|
|
|
|
|
|
|
# Separator must be / \ or .
|
|
|
|
|
|
|
|
/a*b/convert_glob_separator=%
|
|
|
|
|
|
|
|
# Can't have separator in a class
|
|
|
|
|
|
|
|
"[ab/cd]"
|
|
|
|
|
|
|
|
"[,-/]"
|
|
|
|
|
|
|
|
/[ab/
|
|
|
|
|
|
|
|
# Length check
|
|
|
|
|
2017-05-19 18:41:10 +02:00
|
|
|
/abc/convert_length=11
|
2017-05-06 18:19:39 +02:00
|
|
|
|
2017-05-19 18:41:10 +02:00
|
|
|
/abc/convert_length=12
|
2017-05-06 18:19:39 +02:00
|
|
|
|
|
|
|
# Now some actual tests
|
|
|
|
|
|
|
|
/a?b[]xy]*c/
|
|
|
|
azb]1234c
|
|
|
|
|
|
|
|
# Tests from the gitwildmatch list, with some additions
|
|
|
|
|
|
|
|
/foo/
|
|
|
|
foo
|
|
|
|
/= Expect no match
|
|
|
|
bar
|
|
|
|
|
|
|
|
//
|
|
|
|
\
|
|
|
|
|
|
|
|
/???/
|
|
|
|
foo
|
|
|
|
\= Expect no match
|
|
|
|
foobar
|
|
|
|
|
|
|
|
/*/
|
|
|
|
foo
|
|
|
|
\
|
|
|
|
|
|
|
|
/f*/
|
|
|
|
foo
|
|
|
|
f
|
|
|
|
|
|
|
|
/*f/
|
|
|
|
oof
|
|
|
|
\= Expect no match
|
|
|
|
foo
|
|
|
|
|
|
|
|
/*foo*/
|
|
|
|
foo
|
|
|
|
food
|
|
|
|
aprilfool
|
|
|
|
|
|
|
|
/*ob*a*r*/
|
|
|
|
foobar
|
|
|
|
|
|
|
|
/*ab/
|
|
|
|
aaaaaaabababab
|
|
|
|
|
|
|
|
/foo\*/
|
|
|
|
foo*
|
|
|
|
|
|
|
|
/foo\*bar/
|
|
|
|
\= Expect no match
|
|
|
|
foobar
|
|
|
|
|
|
|
|
/f\\oo/
|
|
|
|
f\\oo
|
|
|
|
|
|
|
|
/*[al]?/
|
|
|
|
ball
|
|
|
|
|
|
|
|
/[ten]/
|
|
|
|
\= Expect no match
|
|
|
|
ten
|
|
|
|
|
|
|
|
/t[a-g]n/
|
|
|
|
ten
|
|
|
|
|
|
|
|
/a[]]b/
|
|
|
|
a]b
|
|
|
|
|
2017-05-19 18:41:10 +02:00
|
|
|
/a[]a-]b/
|
|
|
|
|
2017-05-06 18:19:39 +02:00
|
|
|
/a[]-]b/
|
|
|
|
a-b
|
|
|
|
a]b
|
|
|
|
\= Expect no match
|
|
|
|
aab
|
|
|
|
|
2017-05-19 18:41:10 +02:00
|
|
|
/a[]a-z]b/
|
2017-05-06 18:19:39 +02:00
|
|
|
aab
|
|
|
|
|
|
|
|
/]/
|
|
|
|
]
|
|
|
|
|
|
|
|
/t[!a-g]n/
|
|
|
|
ton
|
|
|
|
\= Expect no match
|
|
|
|
ten
|
|
|
|
|
|
|
|
'[[:alpha:]][[:digit:]][[:upper:]]'
|
|
|
|
a1B
|
|
|
|
|
|
|
|
'[[:digit:][:upper:][:space:]]'
|
|
|
|
A
|
|
|
|
1
|
|
|
|
\ \=
|
|
|
|
\= Expect no match
|
|
|
|
a
|
|
|
|
.
|
|
|
|
|
|
|
|
'[a-c[:digit:]x-z]'
|
|
|
|
5
|
|
|
|
b
|
|
|
|
y
|
|
|
|
\= Expect no match
|
|
|
|
q
|
|
|
|
|
|
|
|
# End of gitwildmatch tests
|
|
|
|
|
|
|
|
/*.j?g/
|
|
|
|
pic01.jpg
|
|
|
|
.jpg
|
|
|
|
pic02.jxg
|
|
|
|
\= Expect no match
|
|
|
|
pic03.j/g
|
|
|
|
|
|
|
|
/A[+-0]B/
|
|
|
|
A+B
|
|
|
|
A.B
|
|
|
|
A0B
|
|
|
|
\= Expect no match
|
|
|
|
A/B
|
|
|
|
|
|
|
|
/*x?z/
|
|
|
|
abc.xyz
|
|
|
|
\= Expect no match
|
|
|
|
.xyz
|
|
|
|
|
|
|
|
/?x?z/
|
|
|
|
axyz
|
|
|
|
\= Expect no match
|
|
|
|
.xyz
|
|
|
|
|
|
|
|
"[,-0]x?z"
|
|
|
|
,xyz
|
|
|
|
\= Expect no match
|
|
|
|
/xyz
|
|
|
|
.xyz
|
|
|
|
|
|
|
|
".x*"
|
|
|
|
.xabc
|
|
|
|
|
|
|
|
/a[--0]z/
|
|
|
|
a-z
|
|
|
|
a.z
|
|
|
|
a0z
|
|
|
|
\= Expect no match
|
|
|
|
a/z
|
|
|
|
a1z
|
|
|
|
|
|
|
|
/<[a-c-d]>/
|
|
|
|
<a>
|
|
|
|
<b>
|
|
|
|
<c>
|
|
|
|
<d>
|
|
|
|
<->
|
|
|
|
|
|
|
|
/a[[:digit:].]z/
|
|
|
|
a1z
|
|
|
|
a.z
|
|
|
|
\= Expect no match
|
|
|
|
a:z
|
|
|
|
|
|
|
|
/a[[:digit].]z/
|
|
|
|
a[.]z
|
|
|
|
a:.]z
|
|
|
|
ad.]z
|
|
|
|
|
|
|
|
/<[[:a[:digit:]b]>/
|
|
|
|
<[>
|
|
|
|
<:>
|
|
|
|
<a>
|
|
|
|
<9>
|
|
|
|
<b>
|
|
|
|
\= Expect no match
|
|
|
|
<d>
|
|
|
|
|
|
|
|
/a*b/convert_glob_separator=\
|
|
|
|
|
|
|
|
/a*b/convert_glob_separator=.
|
|
|
|
|
|
|
|
/a*b/convert_glob_separator=/
|
|
|
|
|
2017-05-16 09:14:11 +02:00
|
|
|
# Non control character checking
|
|
|
|
|
|
|
|
/A\B\\C\D/
|
|
|
|
|
2017-05-17 15:44:24 +02:00
|
|
|
/\\{}\?\*+\[\]()|.^$/
|
2017-05-16 09:14:11 +02:00
|
|
|
|
|
|
|
/*a*\/*b*/
|
|
|
|
|
|
|
|
/?a?\/?b?/
|
|
|
|
|
2017-05-18 08:46:22 +02:00
|
|
|
/[a\\b\c][]][-][\]\-]/
|
|
|
|
|
|
|
|
/[^a\\b\c][!]][!-][^\]\-]/
|
|
|
|
|
2017-05-28 06:05:58 +02:00
|
|
|
/[[:alnum:][:alpha:][:blank:][:cntrl:][:digit:][:graph:][:lower:][:print:][:punct:][:space:][:upper:][:word:][:xdigit:]]/
|
2017-05-18 08:46:22 +02:00
|
|
|
|
2017-05-24 12:14:43 +02:00
|
|
|
"[/-/]"
|
|
|
|
|
|
|
|
/[-----]/
|
|
|
|
|
|
|
|
/[------]/
|
|
|
|
|
|
|
|
/[!------]/
|
|
|
|
|
|
|
|
/[[:alpha:]-a]/
|
|
|
|
|
2017-05-25 15:19:42 +02:00
|
|
|
/[[:alpha:]][[:punct:]][[:ascii:]]/
|
|
|
|
|
2017-05-24 12:14:43 +02:00
|
|
|
/[a-[:alpha:]]/
|
|
|
|
|
2017-05-18 08:46:22 +02:00
|
|
|
/[[:alpha:/
|
|
|
|
|
|
|
|
/[[:alpha:]/
|
|
|
|
|
|
|
|
/[[:alphaa:]]/
|
|
|
|
|
|
|
|
/[[:xdigi:]]/
|
|
|
|
|
|
|
|
/[[:xdigit::]]/
|
|
|
|
|
2017-05-19 05:55:39 +02:00
|
|
|
/****/
|
|
|
|
|
|
|
|
/**\/abc/
|
2017-05-24 17:22:03 +02:00
|
|
|
abc
|
|
|
|
x/abc
|
|
|
|
xabc
|
2017-05-19 05:55:39 +02:00
|
|
|
|
|
|
|
/abc\/**/
|
|
|
|
|
|
|
|
/abc\/**\/abc/
|
2017-05-16 09:14:11 +02:00
|
|
|
|
2017-05-23 17:17:44 +02:00
|
|
|
/**\/*a*b*g*n*t/
|
|
|
|
abcd/abcdefg/abcdefghijk/abcdefghijklmnop.txt
|
|
|
|
|
|
|
|
/**\/*a*\/**/
|
|
|
|
xx/xx/xx/xax/xx/xb
|
|
|
|
|
|
|
|
/**\/*a*/
|
|
|
|
xx/xx/xx/xax
|
|
|
|
xx/xx/xx/xax/xx
|
|
|
|
|
|
|
|
/**\/*a*\/**\/*b*/
|
|
|
|
xx/xx/xx/xax/xx/xb
|
|
|
|
xx/xx/xx/xax/xx/x
|
|
|
|
|
2017-05-24 17:22:03 +02:00
|
|
|
"**a"convert=glob
|
|
|
|
a
|
|
|
|
c/b/a
|
|
|
|
c/b/aaa
|
|
|
|
|
|
|
|
"a**/b"convert=glob
|
|
|
|
a/b
|
|
|
|
ab
|
|
|
|
|
|
|
|
"a/**b"convert=glob
|
|
|
|
a/b
|
|
|
|
ab
|
|
|
|
|
2017-05-22 12:23:36 +02:00
|
|
|
#pattern convert=glob:glob_no_starstar
|
|
|
|
|
|
|
|
/***/
|
|
|
|
|
|
|
|
/**a**/
|
|
|
|
|
|
|
|
#pattern convert=unset
|
|
|
|
#pattern convert=glob:glob_no_wild_separator
|
|
|
|
|
|
|
|
/*/
|
|
|
|
|
|
|
|
/*a*/
|
|
|
|
|
|
|
|
/**a**/
|
|
|
|
|
|
|
|
/a*b/
|
|
|
|
|
|
|
|
/*a*b*/
|
|
|
|
|
|
|
|
/??a??/
|
|
|
|
|
|
|
|
#pattern convert=unset
|
2017-05-23 18:08:48 +02:00
|
|
|
#pattern convert=glob,convert_glob_escape=0
|
2017-05-22 12:23:36 +02:00
|
|
|
|
|
|
|
/a\b\cd/
|
|
|
|
|
|
|
|
/**\/a/
|
|
|
|
|
2017-05-23 18:08:48 +02:00
|
|
|
/a`*b/convert_glob_escape=`
|
|
|
|
|
|
|
|
/a`*b/convert_glob_escape=0
|
|
|
|
|
|
|
|
/a`*b/convert_glob_escape=x
|
|
|
|
|
2017-05-27 19:08:28 +02:00
|
|
|
# -------- Tests of extended POSIX conversion --------
|
2017-05-06 18:19:39 +02:00
|
|
|
|
2017-05-27 19:08:28 +02:00
|
|
|
#pattern convert=unset:posix_extended
|
2017-05-06 18:19:39 +02:00
|
|
|
|
|
|
|
/<[[:a[:digit:]b]>/
|
|
|
|
<[>
|
|
|
|
<:>
|
|
|
|
<a>
|
|
|
|
<9>
|
|
|
|
<b>
|
|
|
|
\= Expect no match
|
|
|
|
<d>
|
|
|
|
|
|
|
|
/a+\1b\\c|d[ab\c]/
|
|
|
|
|
|
|
|
/<[]bc]>/
|
|
|
|
<]>
|
|
|
|
<b>
|
|
|
|
<c>
|
|
|
|
|
|
|
|
/<[^]bc]>/
|
|
|
|
<.>
|
|
|
|
\= Expect no match
|
|
|
|
<]>
|
|
|
|
<b>
|
|
|
|
|
|
|
|
/(a)\1b/
|
|
|
|
a1b
|
|
|
|
\= Expect no match
|
|
|
|
aab
|
|
|
|
|
2017-05-13 19:46:27 +02:00
|
|
|
/(ab)c)d]/
|
|
|
|
Xabc)d]Y
|
|
|
|
|
|
|
|
/a***b/
|
|
|
|
|
2017-05-27 19:08:28 +02:00
|
|
|
# -------- Tests of basic POSIX conversion --------
|
|
|
|
|
2017-05-20 13:40:12 +02:00
|
|
|
#pattern convert=unset:posix_basic
|
2017-05-06 18:19:39 +02:00
|
|
|
|
|
|
|
/a*b+c\+[def](ab)\(cd\)/
|
|
|
|
|
|
|
|
/\(a\)\1b/
|
|
|
|
aab
|
|
|
|
\= Expect no match
|
|
|
|
a1b
|
|
|
|
|
2017-05-10 17:42:13 +02:00
|
|
|
/how.to how\.to/
|
2017-05-27 19:08:28 +02:00
|
|
|
how\nto how.to
|
|
|
|
\= Expect no match
|
|
|
|
how\x{0}to how.to
|
2017-05-09 12:44:50 +02:00
|
|
|
|
2017-05-10 17:42:13 +02:00
|
|
|
/^how to \^how to/
|
2017-05-09 12:44:50 +02:00
|
|
|
|
2017-05-14 14:04:13 +02:00
|
|
|
/^*abc/
|
|
|
|
|
2017-05-13 19:46:27 +02:00
|
|
|
/*abc/
|
|
|
|
X*abcY
|
|
|
|
|
|
|
|
/**abc/
|
|
|
|
XabcY
|
|
|
|
X*abcY
|
2017-05-14 14:04:13 +02:00
|
|
|
X**abcY
|
2017-05-27 19:08:28 +02:00
|
|
|
|
|
|
|
/*ab\(*cd\)/
|
2017-05-13 19:46:27 +02:00
|
|
|
|
|
|
|
/^b\(c^d\)\(^e^f\)/
|
|
|
|
|
|
|
|
/a***b/
|
|
|
|
|
2017-05-06 18:19:39 +02:00
|
|
|
# End of testinput24
|