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

Side by Side Diff: test/mjsunit/string-replace.js

Issue 1565004: Fix bug in string replace with nonparticipating captures. (Closed)
Patch Set: Untabified. Created 10 years, 8 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 | « src/runtime.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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 longstring = longstring + longstring; 171 longstring = longstring + longstring;
172 longstring = longstring + longstring; 172 longstring = longstring + longstring;
173 longstring = longstring + longstring; 173 longstring = longstring + longstring;
174 longstring = longstring + longstring; 174 longstring = longstring + longstring;
175 longstring = longstring + longstring; 175 longstring = longstring + longstring;
176 longstring = longstring + longstring; 176 longstring = longstring + longstring;
177 longstring = longstring + longstring; 177 longstring = longstring + longstring;
178 longstring = longstring + longstring; 178 longstring = longstring + longstring;
179 // longstring.length == 5 << 11 179 // longstring.length == 5 << 11
180 180
181 replaceTest(longstring + longstring, 181 replaceTest(longstring + longstring,
182 "<" + longstring + ">", /<(.*)>/g, "$1$1"); 182 "<" + longstring + ">", /<(.*)>/g, "$1$1");
183 183
184 replaceTest("string 42", "string x", /x/g, function() { return 42; }); 184 replaceTest("string 42", "string x", /x/g, function() { return 42; });
185 replaceTest("string 42", "string x", /x/, function() { return 42; }); 185 replaceTest("string 42", "string x", /x/, function() { return 42; });
186 replaceTest("string 42", "string x", /[xy]/g, function() { return 42; }); 186 replaceTest("string 42", "string x", /[xy]/g, function() { return 42; });
187 replaceTest("string 42", "string x", /[xy]/, function() { return 42; }); 187 replaceTest("string 42", "string x", /[xy]/, function() { return 42; });
188 replaceTest("string true", "string x", /x/g, function() { return true; }); 188 replaceTest("string true", "string x", /x/g, function() { return true; });
189 replaceTest("string null", "string x", /x/g, function() { return null; }); 189 replaceTest("string null", "string x", /x/g, function() { return null; });
190 replaceTest("string undefined", "string x", /x/g, function() { return undefined; }); 190 replaceTest("string undefined", "string x", /x/g, function() { return undefined; });
191
192 replaceTest("aundefinedbundefinedcundefined",
193 "abc", /(.)|(.)/g, function(m, m1, m2, i, s) { return m1+m2; });
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698