Update Perl tester to allow for optimization to be turned off. Required moving

some tests out of the Perl-compatible files.
This commit is contained in:
Philip.Hazel 2018-07-14 16:16:51 +00:00
parent 7db5904b9f
commit a0e367f5b6
5 changed files with 30 additions and 21 deletions

View File

@ -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.

8
testdata/testinput1 vendored
View File

@ -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

10
testdata/testinput2 vendored
View File

@ -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

10
testdata/testoutput1 vendored
View File

@ -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

12
testdata/testoutput2 vendored
View File

@ -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