OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Flags: --harmony-species | |
6 | |
7 // Test the ES2015 @@species feature | 5 // Test the ES2015 @@species feature |
8 | 6 |
9 'use strict'; | 7 'use strict'; |
10 | 8 |
11 let TypedArray = Uint8Array.__proto__; | 9 let TypedArray = Uint8Array.__proto__; |
12 | 10 |
13 // The @@species property exists on the right objects and has the right values | 11 // The @@species property exists on the right objects and has the right values |
14 | 12 |
15 let classesWithSpecies = [RegExp, Array, TypedArray, ArrayBuffer, Map, Set, Prom
ise]; | 13 let classesWithSpecies = [RegExp, Array, TypedArray, ArrayBuffer, Map, Set, Prom
ise]; |
16 let classesWithoutSpecies = [Object, Function, String, Number, Symbol, WeakMap,
WeakSet]; | 14 let classesWithoutSpecies = [Object, Function, String, Number, Symbol, WeakMap,
WeakSet]; |
(...skipping 11 matching lines...) Expand all Loading... |
28 | 26 |
29 // @@species is defined with distinct getters | 27 // @@species is defined with distinct getters |
30 assertEquals(classesWithSpecies.length, | 28 assertEquals(classesWithSpecies.length, |
31 new Set(classesWithSpecies.map(constructor => | 29 new Set(classesWithSpecies.map(constructor => |
32 Object.getOwnPropertyDescriptor( | 30 Object.getOwnPropertyDescriptor( |
33 constructor, Symbol.species).get) | 31 constructor, Symbol.species).get) |
34 ).size); | 32 ).size); |
35 | 33 |
36 for (let constructor of classesWithoutSpecies) | 34 for (let constructor of classesWithoutSpecies) |
37 assertEquals(undefined, constructor[Symbol.species]); | 35 assertEquals(undefined, constructor[Symbol.species]); |
OLD | NEW |