| 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 |
a. Let next be IteratorStep(iter). |
| 13 |
b. ReturnIfAbrupt(next). |
| 14 |
features: [Symbol.iterator] |
| 15 |
---*/ |
| 16 |
|
| 17 |
var iterable = {}; |
| 18 |
|
| 19 |
function MyError() {}; |
| 20 |
iterable[Symbol.iterator] = function() { |
| 21 |
return { |
| 22 |
next: function() { |
| 23 |
throw new MyError(); |
| 24 |
} |
| 25 |
}; |
| 26 |
}; |
| 27 |
|
| 28 |
assert.throws(MyError, function() { |
| 29 |
new Set(iterable); |
| 30 |
}); |