Debian Codegraph @

js/src/tests/test262/language/statements/class/subclass/builtins.js

raw
1 // Copyright (C) 2014 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 es6id: 14.5
5 description: >
6 class sublclassing builtins
7 ---*/
8 class ExtendedUint8Array extends Uint8Array {
9 constructor() {
10 super(10);
11 this[0] = 255;
12 this[1] = 0xFFA;
13 }
14 }
15
16 var eua = new ExtendedUint8Array();
17 assert.sameValue(eua.length, 10, "The value of `eua.length` is `10`");
18 assert.sameValue(eua.byteLength, 10, "The value of `eua.byteLength` is `10`");
19 assert.sameValue(eua[0], 0xFF, "The value of `eua[0]` is `0xFF`");
20 assert.sameValue(eua[1], 0xFA, "The value of `eua[1]` is `0xFA`");
21 assert.sameValue(
22 Object.getPrototypeOf(eua),
23 ExtendedUint8Array.prototype,
24 "`Object.getPrototypeOf(eua)` returns `ExtendedUint8Array.prototype`"
25 );
26 assert.sameValue(
27 Object.prototype.toString.call(eua),
28 "[object Uint8Array]",
29 "`Object.prototype.toString.call(eua)` returns `\"[object Uint8Array]\"`"
30 );
31
32 reportCompare(0, 0);