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

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

Issue 1846303002: Further ES2015 RegExp spec compliance fixes (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix cctest 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 | « test/mjsunit/es6/regexp-flags.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
1 // Copyright 2016 the V8 project authors. All rights reserved. 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 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 log = []; 5 var log = [];
6 6
7 var fake = 7 var fake =
8 { 8 {
9 get source() { 9 get source() {
10 log.push("p"); 10 log.push("p");
(...skipping 26 matching lines...) Expand all
37 } 37 }
38 38
39 testThrows(1); 39 testThrows(1);
40 testThrows(null); 40 testThrows(null);
41 Number.prototype.source = "a"; 41 Number.prototype.source = "a";
42 Number.prototype.flags = "b"; 42 Number.prototype.flags = "b";
43 testThrows(1); 43 testThrows(1);
44 44
45 assertEquals("/pattern/flags", RegExp.prototype.toString.call(fake)); 45 assertEquals("/pattern/flags", RegExp.prototype.toString.call(fake));
46 assertEquals(["p", "ps", "f", "fs"], log); 46 assertEquals(["p", "ps", "f", "fs"], log);
47
48 // Monkey-patching is also possible on RegExp instances
49
50 let weird = /foo/;
51 Object.defineProperty(weird, 'flags', {value: 'bar'});
52 Object.defineProperty(weird, 'source', {value: 'baz'});
53 assertEquals('/baz/bar', weird.toString());
54
55 assertEquals('/(?:)/', RegExp.prototype.toString());
56 assertEquals('(?:)', RegExp.prototype.source);
57 assertEquals('', RegExp.prototype.flags);
OLDNEW
« no previous file with comments | « test/mjsunit/es6/regexp-flags.js ('k') | test/test262/test262.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698