pcre2/testdata/testoutput24

491 lines
6.2 KiB
Plaintext
Raw Normal View History

# 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.
#pattern convert=glob_basic,convert_glob_separator=/
/abc/posix
** The convert and posix modifiers are mutually exclusive
# Separator must be / \ or .
/a*b/convert_glob_separator=%
** Invalid glob separator '%'
# Can't have separator in a class
"[ab/cd]"
2017-05-19 18:41:10 +02:00
(?s)\A(?!/)[ab/cd]\z
"[,-/]"
2017-05-19 18:41:10 +02:00
(?s)\A(?!/)[,-/]\z
/[ab/
** Pattern conversion error at offset 3: missing terminating ] for character class
# Length check
2017-05-19 18:41:10 +02:00
/abc/convert_length=11
** Pattern conversion error at offset 3: no more memory
2017-05-19 18:41:10 +02:00
/abc/convert_length=12
(?s)\Aabc\z
# Now some actual tests
/a?b[]xy]*c/
2017-05-19 18:41:10 +02:00
(?s)\Aa[^/]b(?!/)[\]xy](*COMMIT)[^/]*?c\z
azb]1234c
0: azb]1234c
# Tests from the gitwildmatch list, with some additions
/foo/
2017-05-19 05:55:39 +02:00
(?s)\Afoo\z
foo
0: foo
/= Expect no match
No match
bar
No match
//
2017-05-19 05:55:39 +02:00
(?s)\A\z
\
0:
/???/
2017-05-19 18:41:10 +02:00
(?s)\A[^/][^/][^/]\z
foo
0: foo
\= Expect no match
foobar
No match
/*/
2017-05-19 18:41:10 +02:00
(?s)\A[^/]*?\z
foo
0: foo
\
0:
/f*/
2017-05-19 18:41:10 +02:00
(?s)\Af(*COMMIT)[^/]*?\z
foo
0: foo
f
0: f
/*f/
2017-05-19 18:41:10 +02:00
(?s)\A[^/]*?f\z
oof
0: oof
\= Expect no match
foo
No match
/*foo*/
2017-05-19 18:41:10 +02:00
(?s)\A[^/]*?foo(*COMMIT)[^/]*?\z
foo
0: foo
food
0: food
aprilfool
0: aprilfool
/*ob*a*r*/
2017-05-19 18:41:10 +02:00
(?s)\A[^/]*?ob(*COMMIT)[^/]*?a(*COMMIT)[^/]*?r(*COMMIT)[^/]*?\z
foobar
0: foobar
/*ab/
2017-05-19 18:41:10 +02:00
(?s)\A[^/]*?ab\z
aaaaaaabababab
0: aaaaaaabababab
/foo\*/
2017-05-19 05:55:39 +02:00
(?s)\Afoo\*\z
foo*
0: foo*
/foo\*bar/
2017-05-19 05:55:39 +02:00
(?s)\Afoo\*bar\z
\= Expect no match
foobar
No match
/f\\oo/
2017-05-19 05:55:39 +02:00
(?s)\Af\\oo\z
f\\oo
0: f\oo
/*[al]?/
2017-05-19 18:41:10 +02:00
(?s)\A[^/]*?(?!/)[al][^/]\z
ball
0: ball
/[ten]/
2017-05-19 18:41:10 +02:00
(?s)\A(?!/)[ten]\z
\= Expect no match
ten
No match
/t[a-g]n/
2017-05-19 18:41:10 +02:00
(?s)\At(?!/)[a-g]n\z
ten
0: ten
/a[]]b/
2017-05-19 18:41:10 +02:00
(?s)\Aa(?!/)[\]]b\z
a]b
0: a]b
2017-05-19 18:41:10 +02:00
/a[]a-]b/
** Pattern conversion error at offset 7: missing terminating ] for character class
/a[]-]b/
2017-05-19 18:41:10 +02:00
** Pattern conversion error at offset 6: missing terminating ] for character class
a-b
a]b
\= Expect no match
aab
2017-05-19 18:41:10 +02:00
/a[]a-z]b/
(?s)\Aa(?!/)[\]a-z]b\z
aab
0: aab
/]/
2017-05-19 18:41:10 +02:00
(?s)\A\]\z
]
0: ]
/t[!a-g]n/
2017-05-19 18:41:10 +02:00
(?s)\At[^/a-g]n\z
ton
0: ton
\= Expect no match
ten
No match
'[[:alpha:]][[:digit:]][[:upper:]]'
2017-05-19 18:41:10 +02:00
(?s)\A(?!/)[[:alpha:]](?!/)[[:digit:]](?!/)[[:upper:]]\z
a1B
0: a1B
'[[:digit:][:upper:][:space:]]'
2017-05-19 18:41:10 +02:00
(?s)\A(?!/)[[:digit:][:upper:][:space:]]\z
A
0: A
1
0: 1
\ \=
0:
\= Expect no match
a
No match
.
No match
'[a-c[:digit:]x-z]'
2017-05-19 18:41:10 +02:00
(?s)\A(?!/)[a-c[:digit:]x-z]\z
5
0: 5
b
0: b
y
0: y
\= Expect no match
q
No match
# End of gitwildmatch tests
/*.j?g/
2017-05-19 18:41:10 +02:00
(?s)\A[^/]*?\.j[^/]g\z
pic01.jpg
0: pic01.jpg
.jpg
2017-05-19 18:41:10 +02:00
0: .jpg
pic02.jxg
0: pic02.jxg
\= Expect no match
pic03.j/g
No match
/A[+-0]B/
2017-05-19 18:41:10 +02:00
(?s)\AA(?!/)[+-0]B\z
A+B
0: A+B
A.B
0: A.B
A0B
0: A0B
\= Expect no match
A/B
No match
/*x?z/
2017-05-19 18:41:10 +02:00
(?s)\A[^/]*?x[^/]z\z
abc.xyz
0: abc.xyz
\= Expect no match
.xyz
2017-05-19 18:41:10 +02:00
0: .xyz
/?x?z/
2017-05-19 18:41:10 +02:00
(?s)\A[^/]x[^/]z\z
axyz
0: axyz
\= Expect no match
.xyz
2017-05-19 18:41:10 +02:00
0: .xyz
"[,-0]x?z"
2017-05-19 18:41:10 +02:00
(?s)\A(?!/)[,-0]x[^/]z\z
,xyz
0: ,xyz
\= Expect no match
/xyz
No match
.xyz
2017-05-19 18:41:10 +02:00
0: .xyz
".x*"
2017-05-19 18:41:10 +02:00
(?s)\A\.x(*COMMIT)[^/]*?\z
.xabc
0: .xabc
/a[--0]z/
2017-05-19 18:41:10 +02:00
(?s)\Aa(?!/)[\--0]z\z
a-z
0: a-z
a.z
0: a.z
a0z
0: a0z
\= Expect no match
a/z
No match
a1z
No match
/<[a-c-d]>/
2017-05-19 18:41:10 +02:00
(?s)\A<(?!/)[a-c-d]>\z
<a>
0: <a>
<b>
0: <b>
<c>
0: <c>
<d>
0: <d>
<->
0: <->
/a[[:digit:].]z/
2017-05-19 18:41:10 +02:00
(?s)\Aa(?!/)[[:digit:].]z\z
a1z
0: a1z
a.z
0: a.z
\= Expect no match
a:z
No match
/a[[:digit].]z/
2017-05-19 18:41:10 +02:00
** Pattern conversion error at offset 10: missing terminating ] for character class
a[.]z
a:.]z
ad.]z
/<[[:a[:digit:]b]>/
2017-05-19 18:41:10 +02:00
** Pattern conversion error at offset 6: missing terminating ] for character class
<[>
<:>
<a>
<9>
<b>
\= Expect no match
<d>
/a*b/convert_glob_separator=\
2017-05-19 18:41:10 +02:00
(?s)\Aa(*COMMIT)[^\\]*?b\z
/a*b/convert_glob_separator=.
2017-05-19 18:41:10 +02:00
(?s)\Aa(*COMMIT)[^\.]*?b\z
/a*b/convert_glob_separator=/
2017-05-19 18:41:10 +02:00
(?s)\Aa(*COMMIT)[^/]*?b\z
# Non control character checking
/A\B\\C\D/
2017-05-17 15:44:24 +02:00
(?s)\AAB\\CD\z
2017-05-17 15:44:24 +02:00
/\\{}\?\*+\[\]()|.^$/
(?s)\A\\\{\}\?\*\+\[\]\(\)\|\.\^\$\z
/*a*\/*b*/
2017-05-17 15:44:24 +02:00
(?s)\A[^/]*?a(*COMMIT)[^/]*?/(*COMMIT)[^/]*?b(*COMMIT)[^/]*?\z
/?a?\/?b?/
2017-05-17 15:44:24 +02:00
(?s)\A[^/]a[^/]/[^/]b[^/]\z
/[a\\b\c][]][-][\]\-]/
(?s)\A(?!/)[a\\bc](?!/)[\]](?!/)[\-](?!/)[\]\-]\z
/[^a\\b\c][!]][!-][^\]\-]/
(?s)\A[^/a\\bc][^/\]][^/\-][^/\]\-]\z
/[[:alpha:][:xdigit:][:word:]]/
(?s)\A(?!/)[[:alpha:][:xdigit:][:word:]]\z
/[[:alpha:/
** Pattern conversion error at offset 9: missing terminating ] for character class
/[[:alpha:]/
** Pattern conversion error at offset 10: missing terminating ] for character class
/[[:alphaa:]]/
** Pattern conversion error at offset 11: unknown POSIX class name
/[[:xdigi:]]/
** Pattern conversion error at offset 10: unknown POSIX class name
/[[:xdigit::]]/
** Pattern conversion error at offset 10: missing terminating ] for character class
2017-05-19 05:55:39 +02:00
/****/
(?s)
/**\/abc/
(?s)(?:\A|[^/])abc\z
/abc\/**/
(?s)\Aabc/
/abc\/**\/abc/
(?s)\Aabc/(*COMMIT)(?:.*?/)??abc\z
#pattern convert=unset:posix_extended
/a[[:>:]z/
a[[:>:]z
Failed: error 130 at offset 4: unknown POSIX class name
/<[[:a[:digit:]b]>/
<[[:a[:digit:]b]>
<[>
0: <[>
<:>
0: <:>
<a>
0: <a>
<9>
0: <9>
<b>
0: <b>
\= Expect no match
<d>
No match
/a+\1b\\c|d[ab\c]/
a+1b\\c|d[ab\\c]
/a[[:<:]]b[[:>:]]/
a[[:<:]]b[[:>:]]
/<[]bc]>/
<[]bc]>
<]>
0: <]>
<b>
0: <b>
<c>
0: <c>
/<[^]bc]>/
<[^]bc]>
<.>
0: <.>
\= Expect no match
<]>
No match
<b>
No match
/(a)\1b/
(a)1b
a1b
0: a1b
1: a
\= Expect no match
aab
No match
/(ab)c)d]/
(ab)c\)d\]
Xabc)d]Y
0: abc)d]
1: ab
/a***b/
a*b
#pattern convert=unset:posix_basic
/a*b+c\+[def](ab)\(cd\)/
a*b\+c+[def]\(ab\)(cd)
/\(a\)\1b/
(a)\1b
aab
0: aab
1: a
\= Expect no match
a1b
No match
/how.to how\.to/
how.to how\.to
/^how to \^how to/
^how to \^how to
/^*abc/
^\*abc
/*abc/
\*abc
X*abcY
0: *abc
/**abc/
\**abc
XabcY
0: abc
X*abcY
0: *abc
X**abcY
0: **abc
/^b\(c^d\)\(^e^f\)/
^b(c\^d)(^e\^f)
/a***b/
a*b
#pattern convert=unset
/abc/
# End of testinput24