Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/WeakMap/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.3.1.1
5 esid: sec-weakmap-iterable
6 description: >
7 If the iterable argument is empty, return new WeakMap object.
8 info: |
9 23.3.1.1 WeakMap ( [ iterable ] )
10
11 ...
12 9. Repeat
13 ...
14 d. Let nextItem be IteratorValue(next).
15 e. ReturnIfAbrupt(nextItem).
16 ...
17 features: [Symbol.iterator]
18 ---*/
19
20 var iterable = {};
21 iterable[Symbol.iterator] = function() {
22 return {
23 next: function() {
24 return {
25 get value() {
26 throw new Test262Error();
27 },
28 done: false
29 };
30 }
31 };
32 };
33
34 assert.throws(Test262Error, function() {
35 new WeakMap(iterable);
36 });