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

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

Issue 2434983002: [regexp] Use consistent map checks for fast paths (Closed)
Patch Set: Unmark coerce-* tests as failing Created 4 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 unified diff | Download patch
« no previous file with comments | « src/runtime/runtime-regexp.cc ('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
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 var r1 = /abc/gi; 5 var r1 = /abc/gi;
6 assertEquals("abc", r1.source); 6 assertEquals("abc", r1.source);
7 assertTrue(r1.global); 7 assertTrue(r1.global);
8 assertTrue(r1.ignoreCase); 8 assertTrue(r1.ignoreCase);
9 assertFalse(r1.multiline); 9 assertFalse(r1.multiline);
10 assertFalse(r1.sticky); 10 assertFalse(r1.sticky);
(...skipping 27 matching lines...) Expand all
38 assertTrue(r3.global); 38 assertTrue(r3.global);
39 assertEquals(1, get_count); 39 assertEquals(1, get_count);
40 assertTrue(r3.ignoreCase); 40 assertTrue(r3.ignoreCase);
41 assertEquals(2, get_count); 41 assertEquals(2, get_count);
42 // Overridden flag getters affects the flags getter. 42 // Overridden flag getters affects the flags getter.
43 assertEquals("gi", r3.flags); 43 assertEquals("gi", r3.flags);
44 assertEquals(4, get_count); 44 assertEquals(4, get_count);
45 // Overridden flag getters affect string.replace 45 // Overridden flag getters affect string.replace
46 // TODO(adamk): Add more tests here once we've switched 46 // TODO(adamk): Add more tests here once we've switched
47 // to use [[OriginalFlags]] in more cases. 47 // to use [[OriginalFlags]] in more cases.
48 assertEquals(expected, string.replace(r3, "X")); 48 // TODO(jgruber): This exact case actually causes an infinite loop in the spec
49 assertEquals(5, get_count); 49 // (@@replace sees global = true while BuiltinExec sees global = false).
50 // Comment the test for now and remove / fix once this has been resolved on
51 // the spec side.
52 //assertEquals(expected, string.replace(r3, "X"));
53 //assertEquals(5, get_count);
50 54
51 55
52 function testName(name) { 56 function testName(name) {
53 // Test for ES2017 RegExp web compatibility semantics 57 // Test for ES2017 RegExp web compatibility semantics
54 // https://github.com/tc39/ecma262/pull/511 58 // https://github.com/tc39/ecma262/pull/511
55 assertEquals(name === "source" ? "(?:)" : undefined, 59 assertEquals(name === "source" ? "(?:)" : undefined,
56 RegExp.prototype[name]); 60 RegExp.prototype[name]);
57 assertEquals( 61 assertEquals(
58 "get " + name, 62 "get " + name,
59 Object.getOwnPropertyDescriptor(RegExp.prototype, name).get.name); 63 Object.getOwnPropertyDescriptor(RegExp.prototype, name).get.name);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 }, 114 },
111 get unicode() { 115 get unicode() {
112 map.u = counter++; 116 map.u = counter++;
113 }, 117 },
114 get sticky() { 118 get sticky() {
115 map.y = counter++; 119 map.y = counter++;
116 } 120 }
117 }; 121 };
118 testGenericFlags(object); 122 testGenericFlags(object);
119 assertEquals({ g: 0, i: 1, m: 2, u: 3, y: 4 }, map); 123 assertEquals({ g: 0, i: 1, m: 2, u: 3, y: 4 }, map);
OLDNEW
« no previous file with comments | « src/runtime/runtime-regexp.cc ('k') | test/test262/test262.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698