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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « test/cctest/test-parsing.cc ('k') | test/mjsunit/regexp.js » ('j') | 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 CHECK_PARSE_EQ("[-123]", "[- 1 2 3]"); 169 CHECK_PARSE_EQ("[-123]", "[- 1 2 3]");
170 CHECK_PARSE_EQ("[^123]", "^[1 2 3]"); 170 CHECK_PARSE_EQ("[^123]", "^[1 2 3]");
171 CHECK_PARSE_EQ("]", "']'"); 171 CHECK_PARSE_EQ("]", "']'");
172 CHECK_PARSE_EQ("}", "'}'"); 172 CHECK_PARSE_EQ("}", "'}'");
173 CHECK_PARSE_EQ("[a-b-c]", "[a-b - c]"); 173 CHECK_PARSE_EQ("[a-b-c]", "[a-b - c]");
174 CHECK_PARSE_EQ("[\\d]", "[0-9]"); 174 CHECK_PARSE_EQ("[\\d]", "[0-9]");
175 CHECK_PARSE_EQ("[x\\dz]", "[x 0-9 z]"); 175 CHECK_PARSE_EQ("[x\\dz]", "[x 0-9 z]");
176 CHECK_PARSE_EQ("[\\d-z]", "[0-9 - z]"); 176 CHECK_PARSE_EQ("[\\d-z]", "[0-9 - z]");
177 CHECK_PARSE_EQ("[\\d-\\d]", "[0-9 - 0-9]"); 177 CHECK_PARSE_EQ("[\\d-\\d]", "[0-9 - 0-9]");
178 CHECK_PARSE_EQ("[z-\\d]", "[z - 0-9]"); 178 CHECK_PARSE_EQ("[z-\\d]", "[z - 0-9]");
179 // Control character outside character class.
179 CHECK_PARSE_EQ("\\cj\\cJ\\ci\\cI\\ck\\cK", 180 CHECK_PARSE_EQ("\\cj\\cJ\\ci\\cI\\ck\\cK",
180 "'\\x0a\\x0a\\x09\\x09\\x0b\\x0b'"); 181 "'\\x0a\\x0a\\x09\\x09\\x0b\\x0b'");
181 CHECK_PARSE_EQ("\\c!", "'c!'"); 182 CHECK_PARSE_EQ("\\c!", "'\\c!'");
182 CHECK_PARSE_EQ("\\c_", "'c_'"); 183 CHECK_PARSE_EQ("\\c_", "'\\c_'");
183 CHECK_PARSE_EQ("\\c~", "'c~'"); 184 CHECK_PARSE_EQ("\\c~", "'\\c~'");
185 CHECK_PARSE_EQ("\\c1", "'\\c1'");
186 // Control character inside character class.
187 CHECK_PARSE_EQ("[\\c!]", "[\\ c !]");
188 CHECK_PARSE_EQ("[\\c_]", "[\\x1f]");
189 CHECK_PARSE_EQ("[\\c~]", "[\\ c ~]");
190 CHECK_PARSE_EQ("[\\ca]", "[\\x01]");
191 CHECK_PARSE_EQ("[\\cz]", "[\\x1a]");
192 CHECK_PARSE_EQ("[\\cA]", "[\\x01]");
193 CHECK_PARSE_EQ("[\\cZ]", "[\\x1a]");
194 CHECK_PARSE_EQ("[\\c1]", "[\\x11]");
195
184 CHECK_PARSE_EQ("[a\\]c]", "[a ] c]"); 196 CHECK_PARSE_EQ("[a\\]c]", "[a ] c]");
185 CHECK_PARSE_EQ("\\[\\]\\{\\}\\(\\)\\%\\^\\#\\ ", "'[]{}()%^# '"); 197 CHECK_PARSE_EQ("\\[\\]\\{\\}\\(\\)\\%\\^\\#\\ ", "'[]{}()%^# '");
186 CHECK_PARSE_EQ("[\\[\\]\\{\\}\\(\\)\\%\\^\\#\\ ]", "[[ ] { } ( ) % ^ # ]"); 198 CHECK_PARSE_EQ("[\\[\\]\\{\\}\\(\\)\\%\\^\\#\\ ]", "[[ ] { } ( ) % ^ # ]");
187 CHECK_PARSE_EQ("\\0", "'\\x00'"); 199 CHECK_PARSE_EQ("\\0", "'\\x00'");
188 CHECK_PARSE_EQ("\\8", "'8'"); 200 CHECK_PARSE_EQ("\\8", "'8'");
189 CHECK_PARSE_EQ("\\9", "'9'"); 201 CHECK_PARSE_EQ("\\9", "'9'");
190 CHECK_PARSE_EQ("\\11", "'\\x09'"); 202 CHECK_PARSE_EQ("\\11", "'\\x09'");
191 CHECK_PARSE_EQ("\\11a", "'\\x09a'"); 203 CHECK_PARSE_EQ("\\11a", "'\\x09a'");
192 CHECK_PARSE_EQ("\\011", "'\\x09'"); 204 CHECK_PARSE_EQ("\\011", "'\\x09'");
193 CHECK_PARSE_EQ("\\00011", "'\\x0011'"); 205 CHECK_PARSE_EQ("\\00011", "'\\x0011'");
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 CHECK_PARSE_EQ("[\\11]", "[\\x09]"); 239 CHECK_PARSE_EQ("[\\11]", "[\\x09]");
228 CHECK_PARSE_EQ("[\\11a]", "[\\x09 a]"); 240 CHECK_PARSE_EQ("[\\11a]", "[\\x09 a]");
229 CHECK_PARSE_EQ("[\\011]", "[\\x09]"); 241 CHECK_PARSE_EQ("[\\011]", "[\\x09]");
230 CHECK_PARSE_EQ("[\\00011]", "[\\x00 1 1]"); 242 CHECK_PARSE_EQ("[\\00011]", "[\\x00 1 1]");
231 CHECK_PARSE_EQ("[\\118]", "[\\x09 8]"); 243 CHECK_PARSE_EQ("[\\118]", "[\\x09 8]");
232 CHECK_PARSE_EQ("[\\111]", "[I]"); 244 CHECK_PARSE_EQ("[\\111]", "[I]");
233 CHECK_PARSE_EQ("[\\1111]", "[I 1]"); 245 CHECK_PARSE_EQ("[\\1111]", "[I 1]");
234 CHECK_PARSE_EQ("\\x34", "'\x34'"); 246 CHECK_PARSE_EQ("\\x34", "'\x34'");
235 CHECK_PARSE_EQ("\\x60", "'\x60'"); 247 CHECK_PARSE_EQ("\\x60", "'\x60'");
236 CHECK_PARSE_EQ("\\x3z", "'x3z'"); 248 CHECK_PARSE_EQ("\\x3z", "'x3z'");
237 CHECK_PARSE_EQ("\\c", "'c'"); 249 CHECK_PARSE_EQ("\\c", "'\\c'");
238 CHECK_PARSE_EQ("\\u0034", "'\x34'"); 250 CHECK_PARSE_EQ("\\u0034", "'\x34'");
239 CHECK_PARSE_EQ("\\u003z", "'u003z'"); 251 CHECK_PARSE_EQ("\\u003z", "'u003z'");
240 CHECK_PARSE_EQ("foo[z]*", "(: 'foo' (# 0 - g [z]))"); 252 CHECK_PARSE_EQ("foo[z]*", "(: 'foo' (# 0 - g [z]))");
241 253
242 CHECK_SIMPLE("a", true); 254 CHECK_SIMPLE("a", true);
243 CHECK_SIMPLE("a|b", false); 255 CHECK_SIMPLE("a|b", false);
244 CHECK_SIMPLE("a\\n", false); 256 CHECK_SIMPLE("a\\n", false);
245 CHECK_SIMPLE("^a", false); 257 CHECK_SIMPLE("^a", false);
246 CHECK_SIMPLE("a$", false); 258 CHECK_SIMPLE("a$", false);
247 CHECK_SIMPLE("a\\b!", false); 259 CHECK_SIMPLE("a\\b!", false);
(...skipping 1528 matching lines...) Expand 10 before | Expand all | Expand 10 after
1776 bool in_second = CharacterInSet(&l2, i); 1788 bool in_second = CharacterInSet(&l2, i);
1777 CHECK((in_first || in_second) == CharacterInSet(&all, i)); 1789 CHECK((in_first || in_second) == CharacterInSet(&all, i));
1778 } 1790 }
1779 } 1791 }
1780 1792
1781 1793
1782 TEST(Graph) { 1794 TEST(Graph) {
1783 V8::Initialize(NULL); 1795 V8::Initialize(NULL);
1784 Execute("\\b\\w+\\b", false, true, true); 1796 Execute("\\b\\w+\\b", false, true, true);
1785 } 1797 }
OLDNEW
« 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