summaryrefslogtreecommitdiff
path: root/testdata
diff options
context:
space:
mode:
authorph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>2019-07-13 11:12:03 +0000
committerph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>2019-07-13 11:12:03 +0000
commitd6e7202265ea12fcc49bcfb3669f7d123af478a1 (patch)
tree7c92a20a01aee54ffe3c9113ec2a3e203db991af /testdata
parentb5a16bc0e5067389da3903792951a3b1059f3d68 (diff)
downloadpcre2-d6e7202265ea12fcc49bcfb3669f7d123af478a1.tar.gz
Implement non-atomic positive assertions.
git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@1130 6239d852-aaf2-0410-a92c-79f79f948069
Diffstat (limited to 'testdata')
-rw-r--r--testdata/testinput229
-rw-r--r--testdata/testoutput289
-rw-r--r--testdata/testoutput58
3 files changed, 118 insertions, 8 deletions
diff --git a/testdata/testinput2 b/testdata/testinput2
index a38c3b2..a6c11dd 100644
--- a/testdata/testinput2
+++ b/testdata/testinput2
@@ -5653,4 +5653,33 @@ a)"xI
# Multiplication overflow
/(X{65535})(?<=\1{32770})/
+# ---- Non-atomic assertion tests ----
+
+# Expect error: not allowed as a condition
+/(?(*napla:xx)bc)/
+
+/\A(*pla:.*\b(\w++))(?>.*?\b\1\b){3}/
+ word1 word3 word1 word2 word3 word2 word2 word1 word3 word4
+
+/\A(*napla:.*\b(\w++))(?>.*?\b\1\b){3}/
+ word1 word3 word1 word2 word3 word2 word2 word1 word3 word4
+
+/(*plb:(.)..|(.)...)(\1|\2)/
+ abcdb\=offset=4
+ abcda\=offset=4
+
+/(*naplb:(.)..|(.)...)(\1|\2)/
+ abcdb\=offset=4
+ abcda\=offset=4
+
+/(*non_atomic_positive_lookahead:ab)/B
+
+/(*non_atomic_positive_lookbehind:ab)/B
+
+/(*pla:ab+)/B
+
+/(*napla:ab+)/B
+
+# ----
+
# End of testinput2
diff --git a/testdata/testoutput2 b/testdata/testoutput2
index b5e44f5..32be71d 100644
--- a/testdata/testoutput2
+++ b/testdata/testoutput2
@@ -11117,7 +11117,7 @@ Matched, but too many substrings
------------------------------------------------------------------
Bra
Brazero
- AssertB
+ Assert back
Reverse
CBra 1
abc
@@ -13346,7 +13346,7 @@ Failed: error 144 at offset 5: subpattern name must start with a non-digit
Ket
red
\b
- AssertB
+ Assert back
Reverse
\w
Ket
@@ -13403,7 +13403,7 @@ Failed: error 133 at offset 7: parentheses are too deeply nested (stack check)
Once
\s*+
Ket
- AssertB
+ Assert back
Reverse
\w
Ket
@@ -16619,7 +16619,7 @@ No match
/(?<=(?=.){4,5}x)/B
------------------------------------------------------------------
Bra
- AssertB
+ Assert back
Reverse
Assert
Any
@@ -17086,6 +17086,87 @@ Failed: error 187 at offset 15: lookbehind assertion is too long
/(X{65535})(?<=\1{32770})/
Failed: error 187 at offset 10: lookbehind assertion is too long
+# ---- Non-atomic assertion tests ----
+
+# Expect error: not allowed as a condition
+/(?(*napla:xx)bc)/
+Failed: error 198 at offset 9: atomic assertion expected after (?( or (?(?C)
+
+/\A(*pla:.*\b(\w++))(?>.*?\b\1\b){3}/
+ word1 word3 word1 word2 word3 word2 word2 word1 word3 word4
+No match
+
+/\A(*napla:.*\b(\w++))(?>.*?\b\1\b){3}/
+ word1 word3 word1 word2 word3 word2 word2 word1 word3 word4
+ 0: word1 word3 word1 word2 word3 word2 word2 word1 word3
+ 1: word3
+
+/(*plb:(.)..|(.)...)(\1|\2)/
+ abcdb\=offset=4
+ 0: b
+ 1: b
+ 2: <unset>
+ 3: b
+ abcda\=offset=4
+No match
+
+/(*naplb:(.)..|(.)...)(\1|\2)/
+ abcdb\=offset=4
+ 0: b
+ 1: b
+ 2: <unset>
+ 3: b
+ abcda\=offset=4
+ 0: a
+ 1: <unset>
+ 2: a
+ 3: a
+
+/(*non_atomic_positive_lookahead:ab)/B
+------------------------------------------------------------------
+ Bra
+ Non-atomic assert
+ ab
+ Ket
+ Ket
+ End
+------------------------------------------------------------------
+
+/(*non_atomic_positive_lookbehind:ab)/B
+------------------------------------------------------------------
+ Bra
+ Non-atomic assert back
+ Reverse
+ ab
+ Ket
+ Ket
+ End
+------------------------------------------------------------------
+
+/(*pla:ab+)/B
+------------------------------------------------------------------
+ Bra
+ Assert
+ a
+ b++
+ Ket
+ Ket
+ End
+------------------------------------------------------------------
+
+/(*napla:ab+)/B
+------------------------------------------------------------------
+ Bra
+ Non-atomic assert
+ a
+ b+
+ Ket
+ Ket
+ End
+------------------------------------------------------------------
+
+# ----
+
# End of testinput2
Error -70: PCRE2_ERROR_BADDATA (unknown error number)
Error -62: bad serialized data
diff --git a/testdata/testoutput5 b/testdata/testoutput5
index 4249c5e..cc25dcc 100644
--- a/testdata/testoutput5
+++ b/testdata/testoutput5
@@ -4017,7 +4017,7 @@ MK: a\x{12345}b\x{09}(d)c
------------------------------------------------------------------
Bra
\b
- AssertB
+ Assert back
Reverse
prop Xwd
Ket
@@ -4196,7 +4196,7 @@ Failed: error 125 at offset 2: lookbehind assertion is not fixed length
------------------------------------------------------------------
Bra
^
- AssertB not
+ Assert back not
Assert
\x{10385c}
Ket
@@ -4828,7 +4828,7 @@ MK: ABC
/(?<!)(*sr:)/B
------------------------------------------------------------------
Bra
- AssertB not
+ Assert back not
Ket
Script run
Ket
@@ -4839,7 +4839,7 @@ MK: ABC
/(?<=abc(?=X(*sr:BXY)CCC)XBXYCCC)./B
------------------------------------------------------------------
Bra
- AssertB
+ Assert back
Reverse
abc
Assert