From 0edcbc5e42409ea801908af0917ae11eb70a1435 Mon Sep 17 00:00:00 2001 From: ph10 Date: Sun, 13 Sep 2020 15:56:32 +0000 Subject: [PATCH] Fix delimiters in tests 1 and 4 for correct Perl behaviour (Bugzilla #2641). Also move \K in lookaround tests to test 2 (Perl no longer supports). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@1269 6239d852-aaf2-0410-a92c-79f79f948069 Signed-off-by: Petr Písař --- perltest.sh | 3 +++ testdata/testinput1 | 43 +++++++++++++++++---------------------- testdata/testinput2 | 16 +++++++++++++++ testdata/testinput4 | 8 ++++++-- testdata/testoutput1 | 48 ++++++++++++++++++-------------------------- testdata/testoutput2 | 20 ++++++++++++++++++ testdata/testoutput4 | 8 ++++++-- diff --git a/perltest.sh b/perltest.sh index 8368781..31406c5 100755 --- a/perltest.sh +++ b/perltest.sh @@ -68,6 +68,9 @@ fi # #newline_default commands, which are needed in the relevant pcre2test files, # are ignored. Any other #-command is ignored, with a warning message. # +# The pattern lines should use only / as the delimiter. The other characters +# that pcre2test supports cause problems with this script. +# # The data lines must not have any pcre2test modifiers. Unless # "subject_literal" is on the pattern, data lines are processed as # Perl double-quoted strings, so if they contain " $ or @ characters, these diff --git a/testdata/testinput1 b/testdata/testinput1 index 8d952e2..8a50cfa 100644 --- a/testdata/testinput1 +++ b/testdata/testinput1 @@ -1,6 +1,10 @@ # This set of tests is for features that are compatible with all versions of # Perl >= 5.10, in non-UTF mode. It should run clean for the 8-bit, 16-bit, and # 32-bit PCRE libraries, and also using the perltest.sh script. + +# WARNING: Use only / as the pattern delimiter. Although pcre2test supports +# a number of delimiters, all those other than / give problems with the +# perltest.sh script. #forbid_utf #newline_default lf any anycrlf @@ -1957,7 +1961,7 @@ abc\nzzz qqq\nabc\nzzz -"(?>.*/)foo" +/(?>.*\/)foo/ /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/and/foo \= Expect no match /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/it/you/see/ @@ -3831,12 +3835,13 @@ /(?-x: )/x A\x20B -"(?x)(?-x: \s*#\s*)" +/(?x)(?-x: \s*#\s*)/ A # B \= Expect no match # + A s#s B -"(?x-is)(?:(?-ixs) \s*#\s*) include" +/(?x-is)(?:(?-ixs) \s*#\s*) include/ A #include \= Expect no match A#include @@ -5232,11 +5237,11 @@ name)/mark alphabetabcd endingwxyz -"(?>.*)foo" +/(?>.*)foo/ \= Expect no match abcdfooxyz -"(?>.*?)foo" +/(?>.*?)foo/ abcdfooxyz /(?:(a(*PRUNE)b)){0}(?:(?1)|ac)/ @@ -5423,18 +5428,6 @@ name)/mark \= Expect no match a -/(?=a\Kb)ab/ - ab - -/(?!a\Kb)ac/ - ac - -/^abc(?<=b\Kc)d/ - abcd - -/^abc(?bar))(?bar))(?= 5.10, in non-UTF mode. It should run clean for the 8-bit, 16-bit, and # 32-bit PCRE libraries, and also using the perltest.sh script. + +# WARNING: Use only / as the pattern delimiter. Although pcre2test supports +# a number of delimiters, all those other than / give problems with the +# perltest.sh script. #forbid_utf #newline_default lf any anycrlf @@ -2949,7 +2953,7 @@ No match qqq\nabc\nzzz No match -"(?>.*/)foo" +/(?>.*\/)foo/ /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/and/foo 0: /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/and/foo \= Expect no match @@ -6081,14 +6085,16 @@ No match A\x20B 0: -"(?x)(?-x: \s*#\s*)" +/(?x)(?-x: \s*#\s*)/ A # B 0: # \= Expect no match # No match + A s#s B +No match -"(?x-is)(?:(?-ixs) \s*#\s*) include" +/(?x-is)(?:(?-ixs) \s*#\s*) include/ A #include 0: #include \= Expect no match @@ -8402,12 +8408,12 @@ No match 1: 2: wxyz -"(?>.*)foo" +/(?>.*)foo/ \= Expect no match abcdfooxyz No match -"(?>.*?)foo" +/(?>.*?)foo/ abcdfooxyz 0: foo @@ -8648,22 +8654,6 @@ No match a No match -/(?=a\Kb)ab/ - ab - 0: b - -/(?!a\Kb)ac/ - ac - 0: ac - -/^abc(?<=b\Kc)d/ - abcd - 0: cd - -/^abc(?bar))(?bar))(?\x00< /(?(VERSION=0.0/ Failed: error 179 at offset 14: syntax error or number too big in (?(VERSION condition +# Perl has made \K in lookarounds an error. At the moment PCRE2 still accepts. + +/(?=a\Kb)ab/ + ab + 0: b + +/(?!a\Kb)ac/ + ac + 0: ac + +/^abc(?<=b\Kc)d/ + abcd + 0: cd + +/^abc(?