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

Unified Diff: test/mjsunit/harmony/classes.js

Issue 700523003: Classes: Partial fix for constructor not calling super (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: remove todo 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-classes.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 59371e40611feb9b68306db19aeee1e5100c074d..8748f629ed1f0f653f1a5dfa49fc86059339224a 100644
--- a/test/mjsunit/harmony/classes.js
+++ b/test/mjsunit/harmony/classes.js
@@ -19,8 +19,16 @@
assertEquals(Function.prototype, Object.getPrototypeOf(D));
assertEquals('D', D.name);
+ class D2 { constructor() {} }
+ assertEquals('D2', D2.name);
+
+ // TODO(arv): The logic for the name of anonymous functions in ES6 requires
+ // the below to be 'E';
var E = class {}
- assertEquals('', E.name);
+ assertEquals('', E.name); // Should be 'E'.
+
+ var F = class { constructor() {} };
+ assertEquals('', F.name); // Should be 'F'.
})();
@@ -589,6 +597,33 @@ function assertAccessorDescriptor(object, name) {
})();
+(function TestDefaultConstructorNoCrash() {
+ // Regression test for https://code.google.com/p/v8/issues/detail?id=3661
+ class C {}
+ assertEquals(undefined, C());
+ assertEquals(undefined, C(1));
+ assertTrue(new C() instanceof C);
+ assertTrue(new C(1) instanceof C);
+})();
+
+
+(function TestDefaultConstructor() {
+ var calls = 0;
+ class Base {
+ constructor() {
+ calls++;
+ }
+ }
+ class Derived extends Base {}
+ var object = new Derived;
+ assertEquals(1, calls);
+
+ calls = 0;
+ Derived();
+ assertEquals(1, calls);
+})();
+
+
/* TODO(arv): Implement
(function TestNameBindingInConstructor() {
class C {
« no previous file with comments | « src/runtime/runtime-classes.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698