Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Set/set-iterator-value-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.2.1.1
5 description: >
6 Set ( [ iterable ] )
7
8 When the Set function is called with optional argument iterable the following steps are taken:
9
10 ...
11 9. Repeat
12 ...
13 d. Let nextValue be IteratorValue(next).
14 e. ReturnIfAbrupt(nextValue).
15 features: [Symbol.iterator]
16 ---*/
17
18 var count = 0;
19 var iterable = {};
20
21 function MyError() {}
22 iterable[Symbol.iterator] = function() {
23 return {
24 next: function() {
25 return {
26 get value() {
27 throw new MyError();
28 },
29 done: false
30 };
31 }
32 };
33 };
34
35 assert.throws(MyError, function() {
36 new Set(iterable);
37 });