1function assert(b) {
2 if (!b)
3 throw new Error("Bad assertion");
4}
5
6function assertLengthDescriptorAttributes(ctor, lengthValue) {
7 let descriptor = Object.getOwnPropertyDescriptor(ctor, "length");
8
9 assert(descriptor.value === lengthValue);
10 assert(!descriptor.enumerable);
11 assert(!descriptor.writable);
12 assert(descriptor.configurable);
13}
14
15assertLengthDescriptorAttributes(Array, 1);
16assertLengthDescriptorAttributes(ArrayBuffer, 1);
17assertLengthDescriptorAttributes(Boolean, 1);
18assertLengthDescriptorAttributes(DataView, 3);
19assertLengthDescriptorAttributes(Date, 7);
20assertLengthDescriptorAttributes(Error, 1);
21assertLengthDescriptorAttributes(Function, 1);
22assertLengthDescriptorAttributes(Map, 0);
23assertLengthDescriptorAttributes(Number, 1);
24assertLengthDescriptorAttributes(Object, 1);
25assertLengthDescriptorAttributes(Promise, 1);
26assertLengthDescriptorAttributes(Proxy, 2);
27assertLengthDescriptorAttributes(RegExp, 2);
28assertLengthDescriptorAttributes(Set, 0);
29assertLengthDescriptorAttributes(String, 1);
30assertLengthDescriptorAttributes(Symbol, 0);
31assertLengthDescriptorAttributes(WeakMap, 0);
32assertLengthDescriptorAttributes(WeakSet, 0);
33
34assertLengthDescriptorAttributes(Int8Array, 3);
35assertLengthDescriptorAttributes(Uint8Array, 3);
36assertLengthDescriptorAttributes(Int16Array, 3);
37assertLengthDescriptorAttributes(Uint16Array, 3);
38assertLengthDescriptorAttributes(Int32Array, 3);
39assertLengthDescriptorAttributes(Uint32Array, 3);
40assertLengthDescriptorAttributes(Float32Array, 3);
41assertLengthDescriptorAttributes(Float64Array, 3);