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

Unified Diff: test/mjsunit/es6/regexp-match-lastindex.js

Issue 1410753002: Do not coerce lastIndex of a global RegExp in @@match and @@replace. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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 | « src/js/string.js ('k') | test/mjsunit/es6/regexp-replace-lastindex.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/es6/regexp-match-lastindex.js
diff --git a/test/mjsunit/es6/regexp-match-lastindex.js b/test/mjsunit/es6/regexp-match-lastindex.js
new file mode 100644
index 0000000000000000000000000000000000000000..71cf90df6690ea87681025b0d54aa73ea2837d45
--- /dev/null
+++ b/test/mjsunit/es6/regexp-match-lastindex.js
@@ -0,0 +1,11 @@
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Tests that lastIndex of a global RegExp is overwritten as per
+// ECMA-262 6.0 21.2.5.6 step 8.c.
+
+var global = /./g;
+global.lastIndex = { valueOf: function() { assertUnreachable(); } };
+"x".match(global);
+assertEquals(0, global.lastIndex);
« no previous file with comments | « src/js/string.js ('k') | test/mjsunit/es6/regexp-replace-lastindex.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698