Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Map/iterator-next-failure.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 es6id: 23.1.1.1
5 description: >
6 The iterator is closed when iterable `next` throws an error.
7 info: |
8 Map ( [ iterable ] )
9
10 ...
11 9. Repeat
12 a. Let next be IteratorStep(iter).
13 b. ReturnIfAbrupt(next).
14 features: [Symbol.iterator]
15 ---*/
16
17 var iterable = {};
18 iterable[Symbol.iterator] = function() {
19 return {
20 next: function() {
21 throw new Test262Error();
22 }
23 };
24 };
25
26 assert.throws(Test262Error, function() {
27 new Map(iterable);
28 });