Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Array/from/from-array.js

raw
1 // Copyright 2015 Microsoft Corporation. All rights reserved.
2 // This code is governed by the license found in the LICENSE file.
3
4 /*---
5 description: Passing a valid array
6 esid: sec-array.from
7 es6id: 22.1.2.1
8 ---*/
9
10 var array = [0, 'foo', , Infinity];
11 var result = Array.from(array);
12
13 assert.sameValue(result.length, 4, 'result.length');
14 assert.sameValue(result[0], 0, 'result[0]');
15 assert.sameValue(result[1], 'foo', 'result[1]');
16 assert.sameValue(result[2], undefined, 'result[2]');
17 assert.sameValue(result[3], Infinity, 'result[3]');
18
19 assert.notSameValue(
20 result, array,
21 'result is not the object from items argument'
22 );
23
24 assert(result instanceof Array, 'result instanceof Array');