| 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.4.1.1 |
| 5 |
esid: sec-weakset-iterable |
| 6 |
description: > |
| 7 |
If the iterable argument is empty, return new Weakset object. |
| 8 |
info: | |
| 9 |
23.4.1.1 WeakSet ( [ iterable ] ) |
| 10 |
|
| 11 |
... |
| 12 |
9. Repeat |
| 13 |
... |
| 14 |
d. Let nextValue be IteratorValue(next). |
| 15 |
e. ReturnIfAbrupt(nextValue). |
| 16 |
features: [Symbol.iterator] |
| 17 |
---*/ |
| 18 |
|
| 19 |
var count = 0; |
| 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 WeakSet(iterable); |
| 36 |
}); |