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

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

Issue 8635: Backreferences (Closed)
Patch Set: Added test case Created 12 years, 2 months 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
« src/parser.cc ('K') | « src/parser.cc ('k') | no next file » | 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 e5ec41f7026b0be47a8c851686e1410d485326e4..6adf61bd0da137a88790116d593455a7eea98f24 100644
--- a/test/cctest/test-regexp.cc
+++ b/test/cctest/test-regexp.cc
@@ -140,13 +140,33 @@ TEST(Parser) {
ExpectParse("\\11", "'\t'");
ExpectParse("\\11a", "'\ta'");
ExpectParse("\\011", "'\t'");
+ ExpectParse("\\00011", "'\t'");
ExpectParse("\\118", "'\t8'");
ExpectParse("\\111", "'I'");
ExpectParse("\\1111", "'I1'");
+ ExpectParse("(.)(.)(.)\\1", "(: (^ [&.]) (^ [&.]) (^ [&.]) (<- 1))");
+ ExpectParse("(.)(.)(.)\\2", "(: (^ [&.]) (^ [&.]) (^ [&.]) (<- 2))");
+ ExpectParse("(.)(.)(.)\\3", "(: (^ [&.]) (^ [&.]) (^ [&.]) (<- 3))");
+ ExpectParse("(.)(.)(.)\\4", "(: (^ [&.]) (^ [&.]) (^ [&.]) '\x04')");
+ ExpectParse("(.)(.)(.)\\1*", "(: (^ [&.]) (^ [&.]) (^ [&.])"
+ " (# 0 - g (<- 1)))");
+ ExpectParse("(.)(.)(.)\\2*", "(: (^ [&.]) (^ [&.]) (^ [&.])"
+ " (# 0 - g (<- 2)))");
+ ExpectParse("(.)(.)(.)\\3*", "(: (^ [&.]) (^ [&.]) (^ [&.])"
+ " (# 0 - g (<- 3)))");
+ ExpectParse("(.)(.)(.)\\4*", "(: (^ [&.]) (^ [&.]) (^ [&.])"
+ " (# 0 - g '\x04'))");
+ ExpectParse("(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)\\10",
+ "(: (^ [&.]) (^ [&.]) (^ [&.]) (^ [&.]) (^ [&.]) (^ [&.])"
+ " (^ [&.]) (^ [&.]) (^ [&.]) (^ [&.]) (<- 10))");
+ ExpectParse("(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)\\11",
+ "(: (^ [&.]) (^ [&.]) (^ [&.]) (^ [&.]) (^ [&.]) (^ [&.])"
+ " (^ [&.]) (^ [&.]) (^ [&.]) (^ [&.]) '\x09')");
ExpectParse("[\\0]", "[\0]");
ExpectParse("[\\11]", "[\t]");
ExpectParse("[\\11a]", "[\t a]");
ExpectParse("[\\011]", "[\t]");
+ ExpectParse("[\\00011]", "[\t]");
Lasse Reichstein 2008/10/28 10:09:52 Both Safari and IE take at most the first three oc
Christian Plesner Hansen 2008/10/28 11:17:45 I don't really have an opinion. We could also fol
ExpectParse("[\\118]", "[\t 8]");
ExpectParse("[\\111]", "[I]");
ExpectParse("[\\1111]", "[I 1]");
« src/parser.cc ('K') | « src/parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698