Debian Codegraph @

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