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

Side by Side Diff: test/mjsunit/regexp-capture-3.js

Issue 11818025: Continues Latin-1 support. All tests pass with ENABLE_LATIN_1 flag. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: ARM fix Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 assertEquals("*foo * baz", a); 158 assertEquals("*foo * baz", a);
159 159
160 // We test FilterASCII using regexps that will backtrack forever. Since 160 // We test FilterASCII using regexps that will backtrack forever. Since
161 // a regexp with a non-ASCII character in it can never match an ASCII 161 // a regexp with a non-ASCII character in it can never match an ASCII
162 // string we can test that the relevant node is removed by verifying that 162 // string we can test that the relevant node is removed by verifying that
163 // there is no hang. 163 // there is no hang.
164 function NoHang(re) { 164 function NoHang(re) {
165 "This is an ASCII string that could take forever".match(re); 165 "This is an ASCII string that could take forever".match(re);
166 } 166 }
167 167
168 168 NoHang(/(((.*)*)*x)Ā/); // Continuation after loop is filtered, so is loop.
169 NoHang(/(((.*)*)*x)å/); // Continuation after loop is filtered, so is loop. 169 NoHang(/(((.*)*)*Ā)foo/); // Body of loop filtered.
170 NoHang(/(((.*)*)*å)foo/); // Body of loop filtered. 170 NoHang(/Ā(((.*)*)*x)/); // Everything after a filtered character is filtered.
171 NoHang(/å(((.*)*)*x)/); // Everything after a filtered character is filtered. 171 NoHang(/(((.*)*)*x)Ā/); // Everything before a filtered character is filtered.
172 NoHang(/(((.*)*)*x)å/); // Everything before a filtered character is filtered. 172 NoHang(/[ćăĀ](((.*)*)*x)/); // Everything after a filtered class is filtered.
173 NoHang(/[æøå](((.*)*)*x)/); // Everything after a filtered class is filtered. 173 NoHang(/(((.*)*)*x)[ćăĀ]/); // Everything before a filtered class is filtered.
174 NoHang(/(((.*)*)*x)[æøå]/); // Everything before a filtered class is filtered. 174 NoHang(/[^\x00-\xff](((.*)*)*x)/); // After negated class.
175 NoHang(/[^\x00-\x7f](((.*)*)*x)/); // After negated class. 175 NoHang(/(((.*)*)*x)[^\x00-\xff]/); // Before negated class.
176 NoHang(/(((.*)*)*x)[^\x00-\x7f]/); // Before negated class. 176 NoHang(/(?!(((.*)*)*x)Ā)foo/); // Negative lookahead is filtered.
177 NoHang(/(?!(((.*)*)*x)å)foo/); // Negative lookahead is filtered. 177 NoHang(/(?!(((.*)*)*x))Ā/); // Continuation branch of negative lookahead.
178 NoHang(/(?!(((.*)*)*x))å/); // Continuation branch of negative lookahead. 178 NoHang(/(?=(((.*)*)*x)Ā)foo/); // Positive lookahead is filtered.
179 NoHang(/(?=(((.*)*)*x)å)foo/); // Positive lookahead is filtered. 179 NoHang(/(?=(((.*)*)*x))Ā/); // Continuation branch of positive lookahead.
180 NoHang(/(?=(((.*)*)*x))å/); // Continuation branch of positive lookahead. 180 NoHang(/(?=Ā)(((.*)*)*x)/); // Positive lookahead also prunes continuation.
181 NoHang(/(?=å)(((.*)*)*x)/); // Positive lookahead also prunes continuation. 181 NoHang(/(æ|ø|Ā)(((.*)*)*x)/); // All branches of alternation are filtered.
182 NoHang(/(æ|ø|å)(((.*)*)*x)/); // All branches of alternation are filtered. 182 NoHang(/(a|b|(((.*)*)*x))Ā/); // 1 out of 3 branches pruned.
183 NoHang(/(a|b|(((.*)*)*x))å/); // 1 out of 3 branches pruned. 183 NoHang(/(a|(((.*)*)*x)ă|(((.*)*)*x)Ā)/); // 2 out of 3 branches pruned.
184 NoHang(/(a|(((.*)*)*x)ø|(((.*)*)*x)å)/); // 2 out of 3 branches pruned.
185 184
186 var s = "Don't prune based on a repetition of length 0"; 185 var s = "Don't prune based on a repetition of length 0";
187 assertEquals(null, s.match(/å{1,1}prune/)); 186 assertEquals(null, s.match(/å{1,1}prune/));
188 assertEquals("prune", (s.match(/å{0,0}prune/)[0])); 187 assertEquals("prune", (s.match(/å{0,0}prune/)[0]));
189 188
190 // Some very deep regexps where FilterASCII gives up in order not to make the 189 // Some very deep regexps where FilterASCII gives up in order not to make the
191 // stack overflow. 190 // stack overflow.
192 var regex6 = /a*\u0100*\w/; 191 var regex6 = /a*\u0100*\w/;
193 var input0 = "a"; 192 var input0 = "a";
194 regex6.exec(input0); 193 regex6.exec(input0);
(...skipping 15 matching lines...) Expand all
210 regex9.exec(input0); 209 regex9.exec(input0);
211 210
212 var regex10 = new RegExp(re, "i"); 211 var regex10 = new RegExp(re, "i");
213 regex10.exec(input0); 212 regex10.exec(input0);
214 213
215 var regex11 = /^(?:[^\u0000-\u0080]|[0-9a-z?,.!&\s#()])+$/i; 214 var regex11 = /^(?:[^\u0000-\u0080]|[0-9a-z?,.!&\s#()])+$/i;
216 regex11.exec(input0); 215 regex11.exec(input0);
217 216
218 var regex12 = /u(\xf0{8}?\D*?|( ? !)$h??(|)*?(||)+?\6((?:\W\B|--\d-*-|)?$){0, }? |^Y( ? !1)\d+)+a/; 217 var regex12 = /u(\xf0{8}?\D*?|( ? !)$h??(|)*?(||)+?\6((?:\W\B|--\d-*-|)?$){0, }? |^Y( ? !1)\d+)+a/;
219 regex12.exec(""); 218 regex12.exec("");
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698