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

Unified Diff: test/mjsunit/string-replace.js

Issue 2663803002: [string] Migrate String.prototype.{split,replace} to TF (Closed)
Patch Set: Remove debug-evaluate whitelisting Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/debugger/debug/debug-evaluate-no-side-effect-builtins.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/string-replace.js
diff --git a/test/mjsunit/string-replace.js b/test/mjsunit/string-replace.js
index e8392ae2bf0b25bd44e028e47e570dd523317fd8..b391b8c2f5f98c30288cdcb2f66078d5121107dd 100644
--- a/test/mjsunit/string-replace.js
+++ b/test/mjsunit/string-replace.js
@@ -283,3 +283,16 @@ function testIndices59(re) {
testIndices59(new RegExp(regexp59pattern));
testIndices59(new RegExp(regexp59pattern, "g"));
+
+// Test that ToString(replace) is called.
+
+let replace_tostring_count = 0;
+const fake_replacer = {
+ [Symbol.toPrimitive]: () => { replace_tostring_count++; return "b"; }
+};
+
+"a".replace("x", fake_replacer);
+assertEquals(1, replace_tostring_count);
+
+"a".replace("a", fake_replacer);
+assertEquals(2, replace_tostring_count);
« no previous file with comments | « test/debugger/debug/debug-evaluate-no-side-effect-builtins.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698