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

Unified Diff: test/mjsunit/regexp-global.js

Issue 10454032: Fix creating substring in string.replace(<global regexp>, <function>). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
« src/runtime.cc ('K') | « src/runtime.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/regexp-global.js
diff --git a/test/mjsunit/regexp-global.js b/test/mjsunit/regexp-global.js
index fac5c6af03fd11dfcb3a4527d948c0e56b47315d..4b833d7c6c69a037878e8ae13109e38a69250810 100644
--- a/test/mjsunit/regexp-global.js
+++ b/test/mjsunit/regexp-global.js
@@ -125,3 +125,8 @@ str = str.replace(/(FOUR|TWO) \u817f (GOOD|BAD)/g,
return match.length - 7;
});
assertEquals("4, 2!", str);
+
+// Test capture that is a real substring.
Lasse Reichstein Nielsen 2012/05/29 09:06:52 Description isn't very descriptive :) You are test
Lasse Reichstein Nielsen 2012/05/29 10:41:28 Actually, you are testing a capture that *isn't* a
+var str = "Beasts of England, beasts of Ireland";
+str = str.replace(/(.*)/g, function(match) { return '~'; });
+assertEquals("~~");
Lasse Reichstein Nielsen 2012/05/29 09:06:52 Shouldn't there be a second argument here, probabl
Lasse Reichstein Nielsen 2012/05/29 10:41:28 My bad, you already fixed that.
« src/runtime.cc ('K') | « src/runtime.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698