Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(934)

Unified Diff: test/cctest/test-regexp.cc

Issue 1522353002: [regexp] break recursion in mutually recursive capture/back references. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: new test expectations Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/parsing/parser.cc ('k') | test/mjsunit/harmony/regexp-lookbehind.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-regexp.cc
diff --git a/test/cctest/test-regexp.cc b/test/cctest/test-regexp.cc
index ca432cfde6035fc4d8417a1f659e9b3f7fb2fa53..26b019eeb9e7c6ad4b09f526fed0a0b7c9cf2379 100644
--- a/test/cctest/test-regexp.cc
+++ b/test/cctest/test-regexp.cc
@@ -110,6 +110,9 @@ static void CheckParseEq(const char* input, const char* expected) {
CHECK(result.error.is_null());
std::ostringstream os;
result.tree->Print(os, &zone);
+ if (strcmp(expected, os.str().c_str()) != 0) {
+ printf("%s | %s\n", expected, os.str().c_str());
+ }
CHECK_EQ(0, strcmp(expected, os.str().c_str()));
}
@@ -269,6 +272,7 @@ void TestRegExpParser(bool lookbehind) {
CheckParseEq("(a)\\1", "(: (^ 'a') (<- 1))");
CheckParseEq("(a\\1)", "(^ 'a')");
CheckParseEq("(\\1a)", "(^ 'a')");
+ CheckParseEq("(\\2)(\\1)", "(: (^ (<- 2)) (^ (<- 1)))");
CheckParseEq("(?=a)?a", "'a'");
CheckParseEq("(?=a){0,10}a", "'a'");
CheckParseEq("(?=a){1,10}a", "(: (-> + 'a') 'a')");
@@ -375,8 +379,8 @@ void TestRegExpParser(bool lookbehind) {
CHECK_MIN_MAX("(?:ab)|cde", 2, 3);
CHECK_MIN_MAX("(ab)", 2, 2);
CHECK_MIN_MAX("(ab|cde)", 2, 3);
- CHECK_MIN_MAX("(ab)\\1", 2, 4);
- CHECK_MIN_MAX("(ab|cde)\\1", 2, 6);
+ CHECK_MIN_MAX("(ab)\\1", 2, RegExpTree::kInfinity);
+ CHECK_MIN_MAX("(ab|cde)\\1", 2, RegExpTree::kInfinity);
CHECK_MIN_MAX("(?:ab)?", 0, 2);
CHECK_MIN_MAX("(?:ab)*", 0, RegExpTree::kInfinity);
CHECK_MIN_MAX("(?:ab)+", 2, RegExpTree::kInfinity);
« no previous file with comments | « src/parsing/parser.cc ('k') | test/mjsunit/harmony/regexp-lookbehind.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698