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

Side by Side Diff: test/mjsunit/regexp-lastIndex.js

Issue 2344773002: Reland of Put RegExp js code in strict mode (patchset #2 id:20001 of https://codereview.chromium.or… (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Simplify test262 expectations Created 4 years, 3 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/js/regexp.js ('k') | test/test262/test262.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // lastIndex is set only for global or sticky RegExps. On failure to find
6 // a match, it is set to 0. If a set fails, then it acts as if in strict mode
7 // and throws.
8
9 var re = /x/g;
10 Object.defineProperty(re, 'lastIndex', {writable: false});
11 assertThrows(() => re.exec(""), TypeError);
12 assertThrows(() => re.exec("x"), TypeError);
13
14 var re = /x/y;
15 Object.defineProperty(re, 'lastIndex', {writable: false});
16 assertThrows(() => re.exec(""), TypeError);
17 assertThrows(() => re.exec("x"), TypeError);
18
19 var re = /x/;
20 Object.defineProperty(re, 'lastIndex', {writable: false});
21 assertEquals(null, re.exec(""));
22 assertEquals(["x"], re.exec("x"));
OLDNEW
« no previous file with comments | « src/js/regexp.js ('k') | test/test262/test262.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698