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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime/runtime-object.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/classes.js
diff --git a/test/mjsunit/harmony/classes.js b/test/mjsunit/harmony/classes.js
index 8748f629ed1f0f653f1a5dfa49fc86059339224a..1103d7f54ba3550db2ea36d0227d369267f5e1e0 100644
--- a/test/mjsunit/harmony/classes.js
+++ b/test/mjsunit/harmony/classes.js
@@ -624,6 +624,31 @@ function assertAccessorDescriptor(object, name) {
})();
+(function TestDefaultConstructorArguments() {
+ var args, self;
+ class Base {
+ constructor() {
Dmitry Lomov (no reviews) 2014/11/11 10:12:50 Add a test with constructor that takes arguments n
+ self = this;
+ args = arguments;
+ }
+ }
+ class Derived extends Base {}
+
+ new Derived;
+ assertEquals(0, args.length);
+
+ new Derived(0, 1, 2);
+ assertEquals(3, args.length);
+ assertTrue(self instanceof Derived);
+
+ var arr = new Array(1e5);
+ var obj = {};
+ Derived.apply(obj, arr);
+ assertEquals(1e5, args.length);
+ assertEquals(obj, self);
+})();
+
+
/* TODO(arv): Implement
(function TestNameBindingInConstructor() {
class C {
« 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