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

Side by Side Diff: test/mjsunit/es6/classes.js

Issue 2430383004: Remove the 'caller' property from the strict-mode arguments map (Closed)
Patch Set: fix restored test and other Created 4 years, 1 month 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
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 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 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 // Flags: --allow-natives-syntax --harmony-do-expressions 5 // Flags: --allow-natives-syntax --harmony-do-expressions
6 6
7 (function TestBasics() { 7 (function TestBasics() {
8 var C = class C {} 8 var C = class C {}
9 assertEquals(typeof C, 'function'); 9 assertEquals(typeof C, 'function');
10 assertEquals(C.__proto__, Function.prototype); 10 assertEquals(C.__proto__, Function.prototype);
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 class C {} 157 class C {}
158 158
159 with ({a: 1}) { 159 with ({a: 1}) {
160 assertEquals(1, a); 160 assertEquals(1, a);
161 } 161 }
162 162
163 assertThrows('class C extends function B() { with ({}); return B; }() {}', 163 assertThrows('class C extends function B() { with ({}); return B; }() {}',
164 SyntaxError); 164 SyntaxError);
165 165
166 var D = class extends function() { 166 var D = class extends function() {
167 arguments.caller; 167 this.arguments = arguments;
adamk 2016/10/31 18:05:36 Seems reasonable to change this to test arguments.
168 } {}; 168 } {};
169 assertThrows(function() { 169 assertThrows(function() {
170 Object.getPrototypeOf(D).arguments; 170 Object.getPrototypeOf(D).arguments;
171 }, TypeError); 171 }, TypeError);
172 assertThrows(function() { 172 var e = new D();
173 new D; 173 assertEquals(undefined, Object.getOwnPropertyDescriptor(e.arguments, "caller") );
adamk 2016/10/31 18:05:36 Nit: wrap to 80 columns.
174 }, TypeError); 174 assertEquals(undefined, e.arguments.caller);
175 assertEquals(true, Reflect.set(e.arguments, "caller", 0));
adamk 2016/10/31 18:05:36 I don't understand the need for this test. You're
caitp 2016/10/31 18:07:49 I suggested adding this, because property access i
caitp 2016/10/31 18:10:33 specifically, this also checks that the property i
adamk 2016/10/31 18:29:15 I just don't think it makes sense to test property
176 assertEquals(Object.getOwnPropertyDescriptor(e.arguments, "caller"), {
177 value: 0,
178 configurable: true,
179 enumerable: true,
180 writable: true
181 });
175 })(); 182 })();
176 183
177 184
178 (function TestToString() { 185 (function TestToString() {
179 class C {} 186 class C {}
180 assertEquals('class C {}', C.toString()); 187 assertEquals('class C {}', C.toString());
181 188
182 class D { constructor() { 42; } } 189 class D { constructor() { 42; } }
183 assertEquals('class D { constructor() { 42; } }', D.toString()); 190 assertEquals('class D { constructor() { 42; } }', D.toString());
184 191
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after
1039 function* foo() { 1046 function* foo() {
1040 class C extends (yield) {}; 1047 class C extends (yield) {};
1041 } 1048 }
1042 var g = foo(); 1049 var g = foo();
1043 g.next(); 1050 g.next();
1044 return g.return(42).value; 1051 return g.return(42).value;
1045 } 1052 }
1046 assertEquals(42, usingYieldInExtends()); 1053 assertEquals(42, usingYieldInExtends());
1047 1054
1048 })(); 1055 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698