diff options
author | Sergei Golubchik <serg@mariadb.org> | 2019-04-26 12:25:09 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2019-04-26 12:25:09 +0200 |
commit | 879f7e85aa08dda613ea2f481e53392da4864741 (patch) | |
tree | 4c80f89f6db2fbf5b8279453648aa279a19e2db0 /pcre/pcrecpp_unittest.cc | |
parent | cf242aded51f1e1fb53b75911ab7e4da3af37eb4 (diff) | |
download | mariadb-git-879f7e85aa08dda613ea2f481e53392da4864741.tar.gz |
8.43
Diffstat (limited to 'pcre/pcrecpp_unittest.cc')
-rw-r--r-- | pcre/pcrecpp_unittest.cc | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/pcre/pcrecpp_unittest.cc b/pcre/pcrecpp_unittest.cc index 4b15fbef1c3..1fc01a042b3 100644 --- a/pcre/pcrecpp_unittest.cc +++ b/pcre/pcrecpp_unittest.cc @@ -309,7 +309,7 @@ static void TestReplace() { "@aa", "@@@", 3 }, -#ifdef SUPPORT_UTF8 +#ifdef SUPPORT_UTF { "b*", "bb", "\xE3\x83\x9B\xE3\x83\xBC\xE3\x83\xA0\xE3\x81\xB8", // utf8 @@ -327,7 +327,7 @@ static void TestReplace() { { "", NULL, NULL, NULL, NULL, 0 } }; -#ifdef SUPPORT_UTF8 +#ifdef SUPPORT_UTF const bool support_utf8 = true; #else const bool support_utf8 = false; @@ -535,7 +535,7 @@ static void TestQuoteMetaLatin1() { } static void TestQuoteMetaUtf8() { -#ifdef SUPPORT_UTF8 +#ifdef SUPPORT_UTF TestQuoteMeta("Pl\xc3\xa1\x63ido Domingo", pcrecpp::UTF8()); TestQuoteMeta("xyz", pcrecpp::UTF8()); // No fancy utf8 TestQuoteMeta("\xc2\xb0", pcrecpp::UTF8()); // 2-byte utf8 (degree symbol) @@ -1178,7 +1178,7 @@ int main(int argc, char** argv) { CHECK(re.error().empty()); // Must have no error } -#ifdef SUPPORT_UTF8 +#ifdef SUPPORT_UTF // Check UTF-8 handling { printf("Testing UTF-8 handling\n"); @@ -1203,6 +1203,30 @@ int main(int argc, char** argv) { RE re_test2("...", pcrecpp::UTF8()); CHECK(re_test2.FullMatch(utf8_string)); + // PH added these tests for leading option settings + + RE re_testZ0("(*CR)(*NO_START_OPT)........."); + CHECK(re_testZ0.FullMatch(utf8_string)); + +#ifdef SUPPORT_UTF + RE re_testZ1("(*UTF8)..."); + CHECK(re_testZ1.FullMatch(utf8_string)); + + RE re_testZ2("(*UTF)..."); + CHECK(re_testZ2.FullMatch(utf8_string)); + +#ifdef SUPPORT_UCP + RE re_testZ3("(*UCP)(*UTF)..."); + CHECK(re_testZ3.FullMatch(utf8_string)); + + RE re_testZ4("(*UCP)(*LIMIT_MATCH=1000)(*UTF)..."); + CHECK(re_testZ4.FullMatch(utf8_string)); + + RE re_testZ5("(*UCP)(*LIMIT_MATCH=1000)(*ANY)(*UTF)..."); + CHECK(re_testZ5.FullMatch(utf8_string)); +#endif +#endif + // Check that '.' matches one byte or UTF-8 character // according to the mode. string ss; @@ -1248,7 +1272,7 @@ int main(int argc, char** argv) { CHECK(!match_sentence.FullMatch(target)); CHECK(!match_sentence_re.FullMatch(target)); } -#endif /* def SUPPORT_UTF8 */ +#endif /* def SUPPORT_UTF */ printf("Testing error reporting\n"); |