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

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

Issue 1679123007: [regexp] implement RegExp.prototype.toString for non-RegExp receiver. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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
« src/js/regexp.js ('K') | « src/js/regexp.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 var log = [];
6
7 var fake = {
8 pattern: function() {
9 log.push("p");
10 return {
11 toString: function() {
12 log.push("ps");
13 return "pattern";
14 }
15 };
16 },
17 flags: function() {
18 log.push("f");
19 return {
20 toString: function() {
21 log.push("fs");
22 return "flags";
23 }
24 };
25 }
26 }
27
28 assertThrows(() => RegExp.prototype.toString.call(1));
29 assertEquals("/pattern/flags", RegExp.prototype.toString.call(fake));
30 assertEquals(["p", "ps", "f", "fs"], log);
OLDNEW
« src/js/regexp.js ('K') | « src/js/regexp.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698