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

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

Issue 8635: Backreferences (Closed)
Patch Set: Added test case Created 12 years, 1 month 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
« src/parser.cc ('K') | « 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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 ExpectParse("[\\w-z]", "[&w - z]"); 133 ExpectParse("[\\w-z]", "[&w - z]");
134 ExpectParse("[\\w-\\d]", "[&w - &d]"); 134 ExpectParse("[\\w-\\d]", "[&w - &d]");
135 ExpectParse("\\cj\\cJ\\ci\\cI\\ck\\cK", "'\n\n\t\t\v\v'"); 135 ExpectParse("\\cj\\cJ\\ci\\cI\\ck\\cK", "'\n\n\t\t\v\v'");
136 ExpectParse("[a\\]c]", "[a ] c]"); 136 ExpectParse("[a\\]c]", "[a ] c]");
137 ExpectParse("\\[\\]\\{\\}\\(\\)\\%\\^\\#\\ ", "'[]{}()%^# '"); 137 ExpectParse("\\[\\]\\{\\}\\(\\)\\%\\^\\#\\ ", "'[]{}()%^# '");
138 ExpectParse("[\\[\\]\\{\\}\\(\\)\\%\\^\\#\\ ]", "[[ ] { } ( ) % ^ # ]"); 138 ExpectParse("[\\[\\]\\{\\}\\(\\)\\%\\^\\#\\ ]", "[[ ] { } ( ) % ^ # ]");
139 ExpectParse("\\0", "'\0'"); 139 ExpectParse("\\0", "'\0'");
140 ExpectParse("\\11", "'\t'"); 140 ExpectParse("\\11", "'\t'");
141 ExpectParse("\\11a", "'\ta'"); 141 ExpectParse("\\11a", "'\ta'");
142 ExpectParse("\\011", "'\t'"); 142 ExpectParse("\\011", "'\t'");
143 ExpectParse("\\00011", "'\t'");
143 ExpectParse("\\118", "'\t8'"); 144 ExpectParse("\\118", "'\t8'");
144 ExpectParse("\\111", "'I'"); 145 ExpectParse("\\111", "'I'");
145 ExpectParse("\\1111", "'I1'"); 146 ExpectParse("\\1111", "'I1'");
147 ExpectParse("(.)(.)(.)\\1", "(: (^ [&.]) (^ [&.]) (^ [&.]) (<- 1))");
148 ExpectParse("(.)(.)(.)\\2", "(: (^ [&.]) (^ [&.]) (^ [&.]) (<- 2))");
149 ExpectParse("(.)(.)(.)\\3", "(: (^ [&.]) (^ [&.]) (^ [&.]) (<- 3))");
150 ExpectParse("(.)(.)(.)\\4", "(: (^ [&.]) (^ [&.]) (^ [&.]) '\x04')");
151 ExpectParse("(.)(.)(.)\\1*", "(: (^ [&.]) (^ [&.]) (^ [&.])"
152 " (# 0 - g (<- 1)))");
153 ExpectParse("(.)(.)(.)\\2*", "(: (^ [&.]) (^ [&.]) (^ [&.])"
154 " (# 0 - g (<- 2)))");
155 ExpectParse("(.)(.)(.)\\3*", "(: (^ [&.]) (^ [&.]) (^ [&.])"
156 " (# 0 - g (<- 3)))");
157 ExpectParse("(.)(.)(.)\\4*", "(: (^ [&.]) (^ [&.]) (^ [&.])"
158 " (# 0 - g '\x04'))");
159 ExpectParse("(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)\\10",
160 "(: (^ [&.]) (^ [&.]) (^ [&.]) (^ [&.]) (^ [&.]) (^ [&.])"
161 " (^ [&.]) (^ [&.]) (^ [&.]) (^ [&.]) (<- 10))");
162 ExpectParse("(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)\\11",
163 "(: (^ [&.]) (^ [&.]) (^ [&.]) (^ [&.]) (^ [&.]) (^ [&.])"
164 " (^ [&.]) (^ [&.]) (^ [&.]) (^ [&.]) '\x09')");
146 ExpectParse("[\\0]", "[\0]"); 165 ExpectParse("[\\0]", "[\0]");
147 ExpectParse("[\\11]", "[\t]"); 166 ExpectParse("[\\11]", "[\t]");
148 ExpectParse("[\\11a]", "[\t a]"); 167 ExpectParse("[\\11a]", "[\t a]");
149 ExpectParse("[\\011]", "[\t]"); 168 ExpectParse("[\\011]", "[\t]");
169 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
150 ExpectParse("[\\118]", "[\t 8]"); 170 ExpectParse("[\\118]", "[\t 8]");
151 ExpectParse("[\\111]", "[I]"); 171 ExpectParse("[\\111]", "[I]");
152 ExpectParse("[\\1111]", "[I 1]"); 172 ExpectParse("[\\1111]", "[I 1]");
153 ExpectParse("\\x34", "'\x34'"); 173 ExpectParse("\\x34", "'\x34'");
154 ExpectParse("\\x3z", "'\x03z'"); 174 ExpectParse("\\x3z", "'\x03z'");
155 } 175 }
156 176
157 177
158 static void ExpectError(const char* input, 178 static void ExpectError(const char* input,
159 const char* expected) { 179 const char* expected) {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 } else { 256 } else {
237 CHECK(node != NULL); 257 CHECK(node != NULL);
238 CHECK(error.is_null()); 258 CHECK(error.is_null());
239 } 259 }
240 } 260 }
241 } 261 }
242 262
243 263
244 // "123456789abcdb".match(/(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(\11)/) 264 // "123456789abcdb".match(/(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(\11)/)
245 // 123456789abcdb,1,2,3,4,5,6,7,8,9,a,b,c,d,b 265 // 123456789abcdb,1,2,3,4,5,6,7,8,9,a,b,c,d,b
OLDNEW
« 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