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

Unified Diff: test/mjsunit/es6/classes-subclass-builtins.js

Issue 1422853004: [es6] Fix Object built-in subclassing. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@weak-subclass
Patch Set: Test updated Created 5 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/js/v8natives.js ('k') | test/mjsunit/es6/super.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/es6/classes-subclass-builtins.js
diff --git a/test/mjsunit/es6/classes-subclass-builtins.js b/test/mjsunit/es6/classes-subclass-builtins.js
index dcc6167c24ac412f8ace504ae26f4f76a36935cb..d75037af7db0897d919ec84f813dbb69735375cc 100644
--- a/test/mjsunit/es6/classes-subclass-builtins.js
+++ b/test/mjsunit/es6/classes-subclass-builtins.js
@@ -18,6 +18,55 @@ function checkPrototypeChain(object, constructors) {
(function() {
+ class A extends Object {
+ constructor(...args) {
+ assertTrue(%IsConstructCall());
+ super(...args);
+ this.a = 42;
+ this.d = 4.2;
+ }
+ }
+
+ var s = new A("foo");
+ assertTrue(s instanceof Object);
+ assertTrue(s instanceof A);
+ assertEquals("object", typeof s);
+ checkPrototypeChain(s, [A, Object]);
+ assertEquals(42, s.a);
+ assertEquals(4.2, s.d);
+
+ var s1 = new A("bar");
+ assertTrue(%HaveSameMap(s, s1));
+
+
+ var n = new A(153);
+ assertTrue(n instanceof Object);
+ assertTrue(n instanceof A);
+ assertEquals("object", typeof s);
+ checkPrototypeChain(s, [A, Object]);
+ assertEquals(42, n.a);
+ assertEquals(4.2, n.d);
+
+ var n1 = new A(312);
+ assertTrue(%HaveSameMap(n, n1));
+ assertTrue(%HaveSameMap(n, s));
+
+
+ var b = new A(true);
+ assertTrue(b instanceof Object);
+ assertTrue(b instanceof A);
+ assertEquals("object", typeof s);
+ checkPrototypeChain(s, [A, Object]);
+ assertEquals(42, b.a);
+ assertEquals(4.2, b.d);
+
+ var b1 = new A(true);
+ assertTrue(%HaveSameMap(b, b1));
+ assertTrue(%HaveSameMap(b, s));
+})();
+
+
+(function() {
class A extends Function {
constructor(...args) {
assertTrue(%IsConstructCall());
« no previous file with comments | « src/js/v8natives.js ('k') | test/mjsunit/es6/super.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698