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

Side by Side Diff: test/mjsunit/es6/pattern-brand-check.js

Issue 1840723002: String.prototype.{match,search} should do only one RegExp brand check (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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/string.js ('k') | no next file » | 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 // Flags: --harmony-regexp-subclass
6
7 function createNonRegExp(calls) {
8 return {
9 get [Symbol.match]() {
10 calls.push("@@match");
11 return undefined;
12 },
13 get [Symbol.replace]() {
14 calls.push("@@replace");
15 return undefined;
16 },
17 get [Symbol.search]() {
18 calls.push("@@search");
19 return undefined;
20 },
21 get [Symbol.split]() {
22 calls.push("@@split");
23 return undefined;
24 },
25 [Symbol.toPrimitive]() {
26 calls.push("@@toPrimitive");
27 return "";
28 }
29 };
30 }
31
32 (function testStringMatchBrandCheck() {
33 var calls = [];
34 "".match(createNonRegExp(calls));
35 assertEquals(["@@match", "@@toPrimitive"], calls);
36 })();
37
38 (function testStringSearchBrandCheck() {
39 var calls = [];
40 "".search(createNonRegExp(calls));
41 assertEquals(["@@search", "@@toPrimitive"], calls);
42 })();
43
44 (function testStringSplitBrandCheck() {
45 var calls = [];
46 "".split(createNonRegExp(calls));
47 assertEquals(["@@split", "@@toPrimitive"], calls);
48 })();
49
50 (function testStringReplaceBrandCheck() {
51 var calls = [];
52 "".replace(createNonRegExp(calls), "");
53 assertEquals(["@@replace", "@@toPrimitive"], calls);
54 })();
OLDNEW
« no previous file with comments | « src/js/string.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698