Index: third_party/re2/re2/testing/parse_test.cc |
diff --git a/third_party/re2/re2/testing/parse_test.cc b/third_party/re2/re2/testing/parse_test.cc |
index 75c02966dbd6a208fb41afc06e520112ebbedc1c..f67b477bf2bd7ef58f7c649a54f9e5418b492620 100644 |
--- a/third_party/re2/re2/testing/parse_test.cc |
+++ b/third_party/re2/re2/testing/parse_test.cc |
@@ -118,24 +118,14 @@ |
{ "(?:a)", "lit{a}" }, |
{ "(?:ab)(?:cd)", "str{abcd}" }, |
{ "(?:a|b)|(?:c|d)", "cc{0x61-0x64}" }, |
- { "a|c", "cc{0x61 0x63}" }, |
- { "a|[cd]", "cc{0x61 0x63-0x64}" }, |
{ "a|.", "dot{}" }, |
- { "[ab]|c", "cc{0x61-0x63}" }, |
- { "[ab]|[cd]", "cc{0x61-0x64}" }, |
- { "[ab]|.", "dot{}" }, |
- { ".|c", "dot{}" }, |
- { ".|[cd]", "dot{}" }, |
- { ".|.", "dot{}" }, |
+ { ".|a", "dot{}" }, |
// Test Perl quoted literals |
{ "\\Q+|*?{[\\E", "str{+|*?{[}" }, |
{ "\\Q+\\E+", "plus{lit{+}}" }, |
{ "\\Q\\\\E", "lit{\\}" }, |
{ "\\Q\\\\\\E", "str{\\\\}" }, |
- { "\\Qa\\E*", "star{lit{a}}" }, |
- { "\\Qab\\E*", "cat{lit{a}star{lit{b}}}" }, |
- { "\\Qabc\\E*", "cat{str{ab}star{lit{c}}}" }, |
// Test Perl \A and \z |
{ "(?m)^", "bol{}" }, |
@@ -222,12 +212,12 @@ |
<< status.Text(); |
string s = re[i]->Dump(); |
EXPECT_EQ(string(tests[i].parse), s) << "Regexp: " << tests[i].regexp |
- << "\nparse: " << string(tests[i].parse) << " s: " << s << " flag=" << f; |
+ << "\nparse: " << tests[i].parse << " s: " << s << " flag=" << f; |
} |
for (int i = 0; i < ntests; i++) { |
for (int j = 0; j < ntests; j++) { |
- EXPECT_EQ(string(tests[i].parse) == string(tests[j].parse), |
+ EXPECT_EQ(string(tests[i].parse) == tests[j].parse, |
RegexpEqualTestingOnly(re[i], re[j])) |
<< "Regexp: " << tests[i].regexp << " " << tests[j].regexp; |
} |
@@ -309,35 +299,11 @@ |
"cat{rep{2,2 lit{x}}alt{emp{}cc{0x30-0x39}}}" }, |
{ "x{2}y|x{2}[0-9]y", |
"cat{rep{2,2 lit{x}}alt{lit{y}cat{cc{0x30-0x39}lit{y}}}}" }, |
- { "n|r|rs", |
- "alt{lit{n}cat{lit{r}alt{emp{}lit{s}}}}" }, |
- { "n|rs|r", |
- "alt{lit{n}cat{lit{r}alt{lit{s}emp{}}}}" }, |
- { "r|rs|n", |
- "alt{cat{lit{r}alt{emp{}lit{s}}}lit{n}}" }, |
- { "rs|r|n", |
- "alt{cat{lit{r}alt{lit{s}emp{}}}lit{n}}" }, |
}; |
// Test that prefix factoring works. |
TEST(TestParse, Prefix) { |
TestParse(prefix_tests, arraysize(prefix_tests), Regexp::PerlX, "prefix"); |
-} |
- |
-Test nested_tests[] = { |
- { "((((((((((x{2}){2}){2}){2}){2}){2}){2}){2}){2}))", |
- "cap{cap{rep{2,2 cap{rep{2,2 cap{rep{2,2 cap{rep{2,2 cap{rep{2,2 cap{rep{2,2 cap{rep{2,2 cap{rep{2,2 cap{rep{2,2 lit{x}}}}}}}}}}}}}}}}}}}}" }, |
- { "((((((((((x{1}){2}){2}){2}){2}){2}){2}){2}){2}){2})", |
- "cap{rep{2,2 cap{rep{2,2 cap{rep{2,2 cap{rep{2,2 cap{rep{2,2 cap{rep{2,2 cap{rep{2,2 cap{rep{2,2 cap{rep{2,2 cap{rep{1,1 lit{x}}}}}}}}}}}}}}}}}}}}}" }, |
- { "((((((((((x{0}){2}){2}){2}){2}){2}){2}){2}){2}){2})", |
- "cap{rep{2,2 cap{rep{2,2 cap{rep{2,2 cap{rep{2,2 cap{rep{2,2 cap{rep{2,2 cap{rep{2,2 cap{rep{2,2 cap{rep{2,2 cap{rep{0,0 lit{x}}}}}}}}}}}}}}}}}}}}}" }, |
- { "((((((x{2}){2}){2}){5}){5}){5})", |
- "cap{rep{5,5 cap{rep{5,5 cap{rep{5,5 cap{rep{2,2 cap{rep{2,2 cap{rep{2,2 lit{x}}}}}}}}}}}}}" }, |
-}; |
- |
-// Test that nested repetition works. |
-TEST(TestParse, Nested) { |
- TestParse(nested_tests, arraysize(nested_tests), Regexp::PerlX, "nested"); |
} |
// Invalid regular expressions |
@@ -363,9 +329,6 @@ |
"(?i)[a-Z]", |
"a{100000}", |
"a{100000,}", |
- "((((((((((x{2}){2}){2}){2}){2}){2}){2}){2}){2}){2})", |
- "(((x{7}){11}){13})", |
- "\\Q\\E*", |
}; |
// Valid in Perl, bad in POSIX |