diff options
author | ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069> | 2018-07-14 16:16:51 +0000 |
---|---|---|
committer | ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069> | 2018-07-14 16:16:51 +0000 |
commit | 34484311a8b860f5199065072534154b8b3640da (patch) | |
tree | c465cabcb2a323d664f6dc8352ac21b0e4cdfb8e | |
parent | 8b88032edf7d216678ede8f9abf15b9bce5c3acc (diff) | |
download | pcre2-34484311a8b860f5199065072534154b8b3640da.tar.gz |
Update Perl tester to allow for optimization to be turned off. Required moving
some tests out of the Perl-compatible files.
git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@963 6239d852-aaf2-0410-a92c-79f79f948069
-rwxr-xr-x | perltest.sh | 11 | ||||
-rw-r--r-- | testdata/testinput1 | 8 | ||||
-rw-r--r-- | testdata/testinput2 | 10 | ||||
-rw-r--r-- | testdata/testoutput1 | 10 | ||||
-rw-r--r-- | testdata/testoutput2 | 12 |
5 files changed, 30 insertions, 21 deletions
diff --git a/perltest.sh b/perltest.sh index 97d21ba..ac33a68 100755 --- a/perltest.sh +++ b/perltest.sh @@ -45,7 +45,7 @@ fi # jitstack ignored # mark show mark information # no_auto_possess ignored -# no_start_optimize ignored +# no_start_optimize insert ({""}) at pattern start (disable Perl optimizing) # subject_literal does not process subjects for escapes # ucp sets Perl's /u modifier # utf invoke UTF-8 functionality @@ -147,6 +147,7 @@ for (;;) $pattern =~ /^\s*((.).*\2)(.*)$/s; $pat = $1; $mod = $3; + $del = $2; # The private "aftertext" modifier means "print $' afterwards". @@ -180,10 +181,14 @@ for (;;) $mod =~ s/ucp,?/u/; - # Remove "no_auto_possess" and "no_start_optimize" (disable PCRE2 optimizations) + # Remove "no_auto_possess". $mod =~ s/no_auto_possess,?//; - $mod =~ s/no_start_optimize,?//; + + # Use no_start_optimize (disable PCRE2 start-up optimization) to disable Perl + # optimization by inserting (??{""}) at the start of the pattern. + + if ($mod =~ s/no_start_optimize,?//) { $pat =~ s/$del/$del(??{""})/; } # Add back retained modifiers and check that the pattern is valid. diff --git a/testdata/testinput1 b/testdata/testinput1 index 5a4ec41..cabc6ef 100644 --- a/testdata/testinput1 +++ b/testdata/testinput1 @@ -5157,14 +5157,6 @@ name)/mark /A(*MARK:A)A+(*SKIP:B)(B|Z) | AAC/x,mark AAAC -/a(*PRUNE:X)bc|qq/mark,no_start_optimize -\= Expect no match - axy - -/a(*THEN:X)bc|qq/mark,no_start_optimize -\= Expect no match - axy - /(?=a(*MARK:A)b)..x/mark abxy \= Expect no match diff --git a/testdata/testinput2 b/testdata/testinput2 index 9b207ef..78a3965 100644 --- a/testdata/testinput2 +++ b/testdata/testinput2 @@ -5440,4 +5440,14 @@ a)"xI /(?<=(?=.){4,5}x)/B +# Perl behaves differently with these when optimization is turned off + +/a(*PRUNE:X)bc|qq/mark,no_start_optimize +\= Expect no match + axy + +/a(*THEN:X)bc|qq/mark,no_start_optimize +\= Expect no match + axy + # End of testinput2 diff --git a/testdata/testoutput1 b/testdata/testoutput1 index 44f4745..a210038 100644 --- a/testdata/testoutput1 +++ b/testdata/testoutput1 @@ -8282,16 +8282,6 @@ No match, mark = m AAAC 0: AAC -/a(*PRUNE:X)bc|qq/mark,no_start_optimize -\= Expect no match - axy -No match, mark = X - -/a(*THEN:X)bc|qq/mark,no_start_optimize -\= Expect no match - axy -No match, mark = X - /(?=a(*MARK:A)b)..x/mark abxy 0: abx diff --git a/testdata/testoutput2 b/testdata/testoutput2 index 124a8b6..9f552dd 100644 --- a/testdata/testoutput2 +++ b/testdata/testoutput2 @@ -16601,6 +16601,18 @@ No match End ------------------------------------------------------------------ +# Perl behaves differently with these when optimization is turned off + +/a(*PRUNE:X)bc|qq/mark,no_start_optimize +\= Expect no match + axy +No match, mark = X + +/a(*THEN:X)bc|qq/mark,no_start_optimize +\= Expect no match + axy +No match, mark = X + # End of testinput2 Error -70: PCRE2_ERROR_BADDATA (unknown error number) Error -62: bad serialized data |