Debian Codegraph @

js/src/tests/test262/built-ins/Array/from/iter-cstm-ctor-err.js

raw
1 // Copyright (C) 2015 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 esid: sec-array.from
5 description: >
6 Error creating object with custom constructor (traversed via iterator)
7 info: |
8 [...]
9 6. If usingIterator is not undefined, then
10 a. If IsConstructor(C) is true, then
11 i. Let A be Construct(C).
12 b. Else,
13 i. Let A be ArrayCreate(0).
14 c. ReturnIfAbrupt(A).
15 features: [Symbol.iterator]
16 ---*/
17
18 var C = function() {
19 throw new Test262Error();
20 };
21 var items = {};
22 items[Symbol.iterator] = function() {};
23
24 assert.throws(Test262Error, function() {
25 Array.from.call(C, items);
26 }, 'Array.from.call(C, items) throws a Test262Error exception');
27
28 reportCompare(0, 0);