Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Array/from/source-object-iterator-1.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: Source object has iterator which throws
6 esid: sec-array.from
7 es6id: 22.1.2.1
8 features: [Symbol.iterator]
9 ---*/
10
11 var array = [2, 4, 8, 16, 32, 64, 128];
12 var obj = {
13 [Symbol.iterator]() {
14 return {
15 index: 0,
16 next() {
17 throw new Test262Error();
18 },
19 isDone: false,
20 get val() {
21 this.index++;
22 if (this.index > 7) {
23 this.isDone = true;
24 }
25 return 1 << this.index;
26 }
27 };
28 }
29 };
30 assert.throws(Test262Error, function() {
31 Array.from(obj);
32 });