Debian Codegraph @

js/src/tests/test262/built-ins/WeakMap/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 esid: sec-weakmap-iterable
5 description: >
6 Return abrupt from next iterator step.
7 info: |
8 23.3.1.1 WeakMap ( [ iterable ] )
9
10 ...
11 9. Repeat
12 a. Let next be IteratorStep(iter).
13 b. ReturnIfAbrupt(next).
14 ...
15 features: [Symbol.iterator]
16 ---*/
17
18 var iterable = {};
19 iterable[Symbol.iterator] = function() {
20 return {
21 next: function() {
22 throw new Test262Error();
23 }
24 };
25 };
26
27 assert.throws(Test262Error, function() {
28 new WeakMap(iterable);
29 });
30
31 reportCompare(0, 0);