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

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

Issue 6171001: Change interpretation of malformed \c? escapes in RegExp to match JSC. (Closed)
Patch Set: Addressed review comments. Created 9 years, 11 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
« no previous file with comments | « test/cctest/test-parsing.cc ('k') | test/mjsunit/regexp.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 3e6709aef43c47aea5da17f787558cc9755c1069..51fef71464d58b3a7395fee48d6373cfb9b0aea1 100644
--- a/test/cctest/test-regexp.cc
+++ b/test/cctest/test-regexp.cc
@@ -176,11 +176,23 @@ TEST(Parser) {
CHECK_PARSE_EQ("[\\d-z]", "[0-9 - z]");
CHECK_PARSE_EQ("[\\d-\\d]", "[0-9 - 0-9]");
CHECK_PARSE_EQ("[z-\\d]", "[z - 0-9]");
+ // Control character outside character class.
CHECK_PARSE_EQ("\\cj\\cJ\\ci\\cI\\ck\\cK",
"'\\x0a\\x0a\\x09\\x09\\x0b\\x0b'");
- CHECK_PARSE_EQ("\\c!", "'c!'");
- CHECK_PARSE_EQ("\\c_", "'c_'");
- CHECK_PARSE_EQ("\\c~", "'c~'");
+ CHECK_PARSE_EQ("\\c!", "'\\c!'");
+ CHECK_PARSE_EQ("\\c_", "'\\c_'");
+ CHECK_PARSE_EQ("\\c~", "'\\c~'");
+ CHECK_PARSE_EQ("\\c1", "'\\c1'");
+ // Control character inside character class.
+ CHECK_PARSE_EQ("[\\c!]", "[\\ c !]");
+ CHECK_PARSE_EQ("[\\c_]", "[\\x1f]");
+ CHECK_PARSE_EQ("[\\c~]", "[\\ c ~]");
+ CHECK_PARSE_EQ("[\\ca]", "[\\x01]");
+ CHECK_PARSE_EQ("[\\cz]", "[\\x1a]");
+ CHECK_PARSE_EQ("[\\cA]", "[\\x01]");
+ CHECK_PARSE_EQ("[\\cZ]", "[\\x1a]");
+ CHECK_PARSE_EQ("[\\c1]", "[\\x11]");
+
CHECK_PARSE_EQ("[a\\]c]", "[a ] c]");
CHECK_PARSE_EQ("\\[\\]\\{\\}\\(\\)\\%\\^\\#\\ ", "'[]{}()%^# '");
CHECK_PARSE_EQ("[\\[\\]\\{\\}\\(\\)\\%\\^\\#\\ ]", "[[ ] { } ( ) % ^ # ]");
@@ -234,7 +246,7 @@ TEST(Parser) {
CHECK_PARSE_EQ("\\x34", "'\x34'");
CHECK_PARSE_EQ("\\x60", "'\x60'");
CHECK_PARSE_EQ("\\x3z", "'x3z'");
- CHECK_PARSE_EQ("\\c", "'c'");
+ CHECK_PARSE_EQ("\\c", "'\\c'");
CHECK_PARSE_EQ("\\u0034", "'\x34'");
CHECK_PARSE_EQ("\\u003z", "'u003z'");
CHECK_PARSE_EQ("foo[z]*", "(: 'foo' (# 0 - g [z]))");
« no previous file with comments | « test/cctest/test-parsing.cc ('k') | test/mjsunit/regexp.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698