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

Side by Side Diff: test/mjsunit/harmony/regexp-flags.js

Issue 1838563003: Remove --harmony-regexps flag (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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 | « test/mjsunit/es6/regexp-sticky.js ('k') | test/mjsunit/harmony/regexp-sticky.js » ('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 2014 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 // Flags: --harmony-regexps --harmony-unicode-regexps
6
7 RegExp.prototype.flags = 'setter should be undefined';
8
9 assertEquals('', RegExp('').flags);
10 assertEquals('', /./.flags);
11 assertEquals('gimuy', RegExp('', 'yugmi').flags);
12 assertEquals('gimuy', /foo/yumig.flags);
13
14 var descriptor = Object.getOwnPropertyDescriptor(RegExp.prototype, 'flags');
15 assertTrue(descriptor.configurable);
16 assertFalse(descriptor.enumerable);
17 assertInstanceof(descriptor.get, Function);
18 assertEquals(undefined, descriptor.set);
19
20 function testGenericFlags(object) {
21 return descriptor.get.call(object);
22 }
23
24 assertEquals('', testGenericFlags({}));
25 assertEquals('i', testGenericFlags({ ignoreCase: true }));
26 assertEquals('uy', testGenericFlags({ global: 0, sticky: 1, unicode: 1 }));
27 assertEquals('m', testGenericFlags({ __proto__: { multiline: true } }));
28 assertThrows(function() { testGenericFlags(); }, TypeError);
29 assertThrows(function() { testGenericFlags(undefined); }, TypeError);
30 assertThrows(function() { testGenericFlags(null); }, TypeError);
31 assertThrows(function() { testGenericFlags(true); }, TypeError);
32 assertThrows(function() { testGenericFlags(false); }, TypeError);
33 assertThrows(function() { testGenericFlags(''); }, TypeError);
34 assertThrows(function() { testGenericFlags(42); }, TypeError);
35
36 var counter = 0;
37 var map = {};
38 var object = {
39 get global() {
40 map.g = counter++;
41 },
42 get ignoreCase() {
43 map.i = counter++;
44 },
45 get multiline() {
46 map.m = counter++;
47 },
48 get unicode() {
49 map.u = counter++;
50 },
51 get sticky() {
52 map.y = counter++;
53 }
54 };
55 testGenericFlags(object);
56 assertEquals({ g: 0, i: 1, m: 2, u: 3, y: 4 }, map);
OLDNEW
« no previous file with comments | « test/mjsunit/es6/regexp-sticky.js ('k') | test/mjsunit/harmony/regexp-sticky.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698