From f949e55e9ca7291214c5094a812221ddf3d8cda3 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Thu, 26 Oct 2017 18:04:41 +0100 Subject: [PATCH] Regex: Add better tests for skipping of comments in expressions. --- test/regress/test_perl_ex.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/regress/test_perl_ex.cpp b/test/regress/test_perl_ex.cpp index 713ee889..6a53256d 100644 --- a/test/regress/test_perl_ex.cpp +++ b/test/regress/test_perl_ex.cpp @@ -210,6 +210,13 @@ void test_options() TEST_INVALID_REGEX("a++(?#abc)?", perl); TEST_INVALID_REGEX("a++(?#abc)*", perl); TEST_INVALID_REGEX("a++(?#abc){2}", perl); + TEST_INVALID_REGEX("a++(?#abc)(?#more)+", perl); + TEST_REGEX_SEARCH("(?x) ab (?#first comment) (?#more) +", perl, "abbbb", match_default, make_array(0, 5, -2, -2)); + TEST_REGEX_SEARCH("ab(?#first comment)(?#more)+", perl, "abbbb", match_default, make_array(0, 5, -2, -2)); + TEST_REGEX_SEARCH("(?x) ab (?#first comment) (?#more) (c)", perl, "abc", match_default, make_array(0, 3, 2, 3, -2, -2)); + TEST_REGEX_SEARCH("ab(?#first comment)(?#more)(c)", perl, "abc", match_default, make_array(0, 3, 2, 3, -2, -2)); + TEST_REGEX_SEARCH("(?x) ab (?#first comment) (?#more) (?:c)", perl, "abc", match_default, make_array(0, 3, -2, -2)); + TEST_REGEX_SEARCH("ab(?#first comment)(?#more)(?:c)", perl, "abc", match_default, make_array(0, 3, -2, -2)); } void test_options2()