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

Side by Side Diff: test/cctest/test-regexp.cc

Issue 13016: Allow [a-\d] in RegExp parser. (Closed)
Patch Set: Created 12 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 unified diff | Download patch
« no previous file with comments | « src/parser.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2008 the V8 project authors. All rights reserved. 1 // Copyright 2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 CHECK_PARSE_EQ("[a-zA-Z0-9]", "[a-z A-Z 0-9]"); 119 CHECK_PARSE_EQ("[a-zA-Z0-9]", "[a-z A-Z 0-9]");
120 CHECK_PARSE_EQ("[-123]", "[- 1 2 3]"); 120 CHECK_PARSE_EQ("[-123]", "[- 1 2 3]");
121 CHECK_PARSE_EQ("[^123]", "^[1 2 3]"); 121 CHECK_PARSE_EQ("[^123]", "^[1 2 3]");
122 CHECK_PARSE_EQ("]", "']'"); 122 CHECK_PARSE_EQ("]", "']'");
123 CHECK_PARSE_EQ("}", "'}'"); 123 CHECK_PARSE_EQ("}", "'}'");
124 CHECK_PARSE_EQ("[a-b-c]", "[a-b - c]"); 124 CHECK_PARSE_EQ("[a-b-c]", "[a-b - c]");
125 CHECK_PARSE_EQ("[\\d]", "[0-9]"); 125 CHECK_PARSE_EQ("[\\d]", "[0-9]");
126 CHECK_PARSE_EQ("[x\\dz]", "[x 0-9 z]"); 126 CHECK_PARSE_EQ("[x\\dz]", "[x 0-9 z]");
127 CHECK_PARSE_EQ("[\\d-z]", "[0-9 - z]"); 127 CHECK_PARSE_EQ("[\\d-z]", "[0-9 - z]");
128 CHECK_PARSE_EQ("[\\d-\\d]", "[0-9 - 0-9]"); 128 CHECK_PARSE_EQ("[\\d-\\d]", "[0-9 - 0-9]");
129 CHECK_PARSE_EQ("[z-\\d]", "[z - 0-9]");
129 CHECK_PARSE_EQ("\\cj\\cJ\\ci\\cI\\ck\\cK", 130 CHECK_PARSE_EQ("\\cj\\cJ\\ci\\cI\\ck\\cK",
130 "'\\x0a\\x0a\\x09\\x09\\x0b\\x0b'"); 131 "'\\x0a\\x0a\\x09\\x09\\x0b\\x0b'");
131 CHECK_PARSE_EQ("\\c!", "'c!'"); 132 CHECK_PARSE_EQ("\\c!", "'c!'");
132 CHECK_PARSE_EQ("\\c_", "'c_'"); 133 CHECK_PARSE_EQ("\\c_", "'c_'");
133 CHECK_PARSE_EQ("\\c~", "'c~'"); 134 CHECK_PARSE_EQ("\\c~", "'c~'");
134 CHECK_PARSE_EQ("[a\\]c]", "[a ] c]"); 135 CHECK_PARSE_EQ("[a\\]c]", "[a ] c]");
135 CHECK_PARSE_EQ("\\[\\]\\{\\}\\(\\)\\%\\^\\#\\ ", "'[]{}()%^# '"); 136 CHECK_PARSE_EQ("\\[\\]\\{\\}\\(\\)\\%\\^\\#\\ ", "'[]{}()%^# '");
136 CHECK_PARSE_EQ("[\\[\\]\\{\\}\\(\\)\\%\\^\\#\\ ]", "[[ ] { } ( ) % ^ # ]"); 137 CHECK_PARSE_EQ("[\\[\\]\\{\\}\\(\\)\\%\\^\\#\\ ]", "[[ ] { } ( ) % ^ # ]");
137 CHECK_PARSE_EQ("\\0", "'\\x00'"); 138 CHECK_PARSE_EQ("\\0", "'\\x00'");
138 CHECK_PARSE_EQ("\\8", "'8'"); 139 CHECK_PARSE_EQ("\\8", "'8'");
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 V8::Initialize(NULL); 269 V8::Initialize(NULL);
269 const char* kEndBackslash = "\\ at end of pattern"; 270 const char* kEndBackslash = "\\ at end of pattern";
270 ExpectError("\\", kEndBackslash); 271 ExpectError("\\", kEndBackslash);
271 const char* kUnterminatedGroup = "Unterminated group"; 272 const char* kUnterminatedGroup = "Unterminated group";
272 ExpectError("(foo", kUnterminatedGroup); 273 ExpectError("(foo", kUnterminatedGroup);
273 const char* kInvalidGroup = "Invalid group"; 274 const char* kInvalidGroup = "Invalid group";
274 ExpectError("(?", kInvalidGroup); 275 ExpectError("(?", kInvalidGroup);
275 const char* kUnterminatedCharacterClass = "Unterminated character class"; 276 const char* kUnterminatedCharacterClass = "Unterminated character class";
276 ExpectError("[", kUnterminatedCharacterClass); 277 ExpectError("[", kUnterminatedCharacterClass);
277 ExpectError("[a-", kUnterminatedCharacterClass); 278 ExpectError("[a-", kUnterminatedCharacterClass);
278 const char* kIllegalCharacterClass = "Illegal character class";
279 ExpectError("[a-\\w]", kIllegalCharacterClass);
280 const char* kEndControl = "\\c at end of pattern"; 279 const char* kEndControl = "\\c at end of pattern";
281 ExpectError("\\c", kEndControl); 280 ExpectError("\\c", kEndControl);
282 const char* kNothingToRepeat = "Nothing to repeat"; 281 const char* kNothingToRepeat = "Nothing to repeat";
283 ExpectError("*", kNothingToRepeat); 282 ExpectError("*", kNothingToRepeat);
284 ExpectError("?", kNothingToRepeat); 283 ExpectError("?", kNothingToRepeat);
285 ExpectError("+", kNothingToRepeat); 284 ExpectError("+", kNothingToRepeat);
286 ExpectError("{1}", kNothingToRepeat); 285 ExpectError("{1}", kNothingToRepeat);
287 ExpectError("{1,2}", kNothingToRepeat); 286 ExpectError("{1,2}", kNothingToRepeat);
288 ExpectError("{1,}", kNothingToRepeat); 287 ExpectError("{1,}", kNothingToRepeat);
289 } 288 }
(...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after
1156 // whole block at a time. 1155 // whole block at a time.
1157 TestSimpleRangeCaseIndependence(CharacterRange('A', 'k'), 1156 TestSimpleRangeCaseIndependence(CharacterRange('A', 'k'),
1158 CharacterRange('a', 'z')); 1157 CharacterRange('a', 'z'));
1159 } 1158 }
1160 1159
1161 1160
1162 TEST(Graph) { 1161 TEST(Graph) {
1163 V8::Initialize(NULL); 1162 V8::Initialize(NULL);
1164 Execute("foo$(?!bar)", false, true); 1163 Execute("foo$(?!bar)", false, true);
1165 } 1164 }
OLDNEW
« no previous file with comments | « src/parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698