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

Side by Side Diff: test/mjsunit/harmony/new-target.js

Issue 1215973005: [es6] Reenable new.target + Reflect.construct tests (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 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 | « no previous file | 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
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 // Flags: --harmony-classes --harmony-new-target --harmony-reflect 5 // Flags: --harmony-classes --harmony-new-target --harmony-reflect
6 // Flags: --harmony-rest-parameters --harmony-arrow-functions 6 // Flags: --harmony-rest-parameters --harmony-arrow-functions
7 7
8 8
9 (function TestClass() { 9 (function TestClass() {
10 'use strict'; 10 'use strict';
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 constructor(expected) { 149 constructor(expected) {
150 super(expected); 150 super(expected);
151 assertInstanceof(this, RegExp); 151 assertInstanceof(this, RegExp);
152 } 152 }
153 } 153 }
154 assertInstanceof(new Derived2(Derived2), RegExp); 154 assertInstanceof(new Derived2(Derived2), RegExp);
155 assertInstanceof(new Derived2(Derived2, 'extra'), RegExp); 155 assertInstanceof(new Derived2(Derived2, 'extra'), RegExp);
156 })(); 156 })();
157 157
158 158
159 /*
160 // TODO(arv): Reflect.construct does not work correctly with a third argument.
161 (function TestReflectConstruct() { 159 (function TestReflectConstruct() {
162 var calls = 0; 160 var calls = 0;
163 function f(expected) { 161 function f(expected) {
164 calls++; 162 calls++;
165 assertEquals(expected, new.target); 163 assertEquals(expected, new.target);
166 } 164 }
167 165
168 var o = Reflect.construct(f, [f]); 166 var o = Reflect.construct(f, [f]);
169 assertEquals(Object.getPrototypeOf(o), f.prototype); 167 assertEquals(Object.getPrototypeOf(o), f.prototype);
170 o = Reflect.construct(f, [f, 'extra']); 168 o = Reflect.construct(f, [f, 'extra']);
171 assertEquals(Object.getPrototypeOf(o), f.prototype); 169 assertEquals(Object.getPrototypeOf(o), f.prototype);
172 assertEquals(2, calls); 170 assertEquals(2, calls);
173 171
174 calls = 0; 172 calls = 0;
175 o = Reflect.construct(f, [f], f); 173 o = Reflect.construct(f, [f], f);
176 assertEquals(Object.getPrototypeOf(o), f.prototype); 174 assertEquals(Object.getPrototypeOf(o), f.prototype);
177 o = Reflect.construct(f, [f, 'extra'], f); 175 o = Reflect.construct(f, [f, 'extra'], f);
178 assertEquals(Object.getPrototypeOf(o), f.prototype); 176 assertEquals(Object.getPrototypeOf(o), f.prototype);
179 assertEquals(2, calls); 177 assertEquals(2, calls);
180 178
181 179
182 function g() {} 180 function g() {}
183 calls = 0; 181 calls = 0;
184 o = Reflect.construct(f, [g], g); 182 o = Reflect.construct(f, [g], g);
185 assertEquals(Object.getPrototypeOf(o), g.prototype); 183 assertEquals(Object.getPrototypeOf(o), g.prototype);
186 o = Reflect.construct(f, [g, 'extra'], g); 184 o = Reflect.construct(f, [g, 'extra'], g);
187 assertEquals(Object.getPrototypeOf(o), g.prototype); 185 assertEquals(Object.getPrototypeOf(o), g.prototype);
188 assertEquals(2, calls); 186 assertEquals(2, calls);
189 })(); 187 })();
190 */
191 188
192 189
193 (function TestRestParametersFunction() { 190 (function TestRestParametersFunction() {
194 function f(...rest) { 191 function f(...rest) {
195 assertEquals(rest[0], new.target); 192 assertEquals(rest[0], new.target);
196 } 193 }
197 194
198 assertInstanceof(new f(f), f); 195 assertInstanceof(new f(f), f);
199 assertInstanceof(new f(f, 'extra'), f); 196 assertInstanceof(new f(f, 'extra'), f);
200 })(); 197 })();
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 a0 = 1; 361 a0 = 1;
365 a1 = 2; 362 a1 = 2;
366 f(1, 2); 363 f(1, 2);
367 364
368 length = 3; 365 length = 3;
369 a0 = 1; 366 a0 = 1;
370 a1 = 2; 367 a1 = 2;
371 a2 = 3; 368 a2 = 3;
372 f(1, 2, 3); 369 f(1, 2, 3);
373 })(); 370 })();
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698