Debian Codegraph @

js/src/tests/test262/built-ins/Array/from/mapfn-is-symbol-throws.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: Throws a TypeError if mapFn is not callable (Symbol)
6 info: |
7 22.1.2.1 Array.from ( items [ , mapfn [ , thisArg ] ] )
8
9 ...
10 2. If mapfn is undefined, let mapping be false.
11 3. else
12 a. If IsCallable(mapfn) is false, throw a TypeError exception.
13 ...
14 features:
15 - Symbol
16 ---*/
17
18 assert.throws(TypeError, function() {
19 Array.from([], Symbol('1'));
20 }, 'Array.from([], Symbol("1")) throws a TypeError exception');
21
22 reportCompare(0, 0);