Debian Codegraph @

js/src/tests/test262/language/statements/class/subclass/builtin-objects/Boolean/regular-subclassing.js

raw
1 // Copyright (C) 2016 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 es6id: 19.3.1
5 description: Subclassing Function
6 info: |
7 19.3.1 The Boolean Constructor
8
9 The Boolean constructor is designed to be subclassable. It may be used as the
10 value of an extends clause of a class definition.
11 ...
12 ---*/
13
14 class Bln extends Boolean {}
15
16 var b1 = new Bln(1);
17
18 assert.notSameValue(b1, true, 'b1 is an Boolean object');
19 assert.sameValue(b1.valueOf(), true);
20
21 var b2 = new Bln(0);
22 assert.notSameValue(b2, false, 'bln is an Boolean object');
23 assert.sameValue(b2.valueOf(), false);
24
25 reportCompare(0, 0);