Debian Codegraph @

js/src/tests/test262/built-ins/Array/from/items-is-arraybuffer.js

raw
1 // Copyright 2015 Leonardo Balter. All rights reserved.
2 // This code is governed by the license found in the LICENSE file.
3 /*---
4 esid: sec-array.from
5 description: Return empty array if items argument is an ArrayBuffer
6 info: |
7 22.1.2.1 Array.from ( items [ , mapfn [ , thisArg ] ] )
8
9 ...
10 4. Let usingIterator be GetMethod(items, @@iterator).
11 5. ReturnIfAbrupt(usingIterator).
12 ...
13 ---*/
14
15 var arrayBuffer = new ArrayBuffer(7);
16
17 var result = Array.from(arrayBuffer);
18
19 assert.sameValue(result.length, 0, 'The value of result.length is expected to be 0');
20
21 reportCompare(0, 0);