From 47faa3ec58e17bc35a4e2b3159bc7505a9590a3f Mon Sep 17 00:00:00 2001
From: Leonardo Balter <leonardo.balter@gmail.com>
Date: Thu, 7 Jan 2016 15:39:00 -0500
Subject: [PATCH] Add tests for Subclassing the built-in Boolean Object

---
 .../Boolean/regular-subclassing.js            | 23 ++++++++++++++
 .../Boolean/super-must-be-called.js           | 31 +++++++++++++++++++
 2 files changed, 54 insertions(+)
 create mode 100644 test/language/subclassing/Boolean/regular-subclassing.js
 create mode 100644 test/language/subclassing/Boolean/super-must-be-called.js

diff --git a/test/language/subclassing/Boolean/regular-subclassing.js b/test/language/subclassing/Boolean/regular-subclassing.js
new file mode 100644
index 0000000000..1ccaf9d9ef
--- /dev/null
+++ b/test/language/subclassing/Boolean/regular-subclassing.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.3.1
+description: Subclassing Function
+info: >
+  19.3.1 The Boolean Constructor
+
+  The Boolean constructor is designed to be subclassable. It may be used as the
+  value of an extends clause of a class definition.
+  ...
+---*/
+
+class Bln extends Boolean {}
+
+var b1 = new Bln(1);
+
+assert.notSameValue(b1, true, 'b1 is an Boolean object');
+assert.sameValue(b1.valueOf(), true);
+
+var b2 = new Bln(0);
+assert.notSameValue(b2, false, 'bln is an Boolean object');
+assert.sameValue(b2.valueOf(), false);
diff --git a/test/language/subclassing/Boolean/super-must-be-called.js b/test/language/subclassing/Boolean/super-must-be-called.js
new file mode 100644
index 0000000000..c384a2bc16
--- /dev/null
+++ b/test/language/subclassing/Boolean/super-must-be-called.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.3.1
+description: Super need to be called to initialize Boolean internals
+info: >
+  19.3.1 The Boolean Constructor
+
+  ...
+  Subclass constructors that intend to inherit the specified Boolean behaviour
+  must include a super call to the Boolean constructor to create and initialize
+  the subclass instance with a [[BooleanData]] internal slot.
+---*/
+
+class Bln extends Boolean {
+  constructor() {}
+}
+
+// Boolean internals are not initialized
+assert.throws(ReferenceError, function() {
+  new Bln(1);
+});
+
+class Bln2 extends Boolean {
+  constructor() {
+    super();
+  }
+}
+
+var b = new Bln2(1);
+assert(b instanceof Boolean);
-- 
GitLab