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

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

Issue 692333011: Classes: Add support for arguments in default constructor (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « src/runtime/runtime-object.cc ('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
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: --harmony-classes 5 // Flags: --harmony-classes
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 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 class Derived extends Base {} 617 class Derived extends Base {}
618 var object = new Derived; 618 var object = new Derived;
619 assertEquals(1, calls); 619 assertEquals(1, calls);
620 620
621 calls = 0; 621 calls = 0;
622 Derived(); 622 Derived();
623 assertEquals(1, calls); 623 assertEquals(1, calls);
624 })(); 624 })();
625 625
626 626
627 (function TestDefaultConstructorArguments() {
628 var args, self;
629 class Base {
630 constructor() {
Dmitry Lomov (no reviews) 2014/11/11 10:12:50 Add a test with constructor that takes arguments n
631 self = this;
632 args = arguments;
633 }
634 }
635 class Derived extends Base {}
636
637 new Derived;
638 assertEquals(0, args.length);
639
640 new Derived(0, 1, 2);
641 assertEquals(3, args.length);
642 assertTrue(self instanceof Derived);
643
644 var arr = new Array(1e5);
645 var obj = {};
646 Derived.apply(obj, arr);
647 assertEquals(1e5, args.length);
648 assertEquals(obj, self);
649 })();
650
651
627 /* TODO(arv): Implement 652 /* TODO(arv): Implement
628 (function TestNameBindingInConstructor() { 653 (function TestNameBindingInConstructor() {
629 class C { 654 class C {
630 constructor() { 655 constructor() {
631 assertThrows(function() { 656 assertThrows(function() {
632 C = 42; 657 C = 42;
633 }, ReferenceError); 658 }, ReferenceError);
634 } 659 }
635 } 660 }
636 new C(); 661 new C();
637 })(); 662 })();
638 */ 663 */
OLDNEW
« no previous file with comments | « src/runtime/runtime-object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698