Debian Codegraph @

js/src/tests/test262/language/statements/for-of/generator-next-error.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: 13.6.4.13 S5.g
5 description: >
6 If `nextResult` is an abrupt completion as per IteratorStep (ES6 7.4.5),
7 return the completion.
8 features: [generators]
9 ---*/
10
11 var iterable = (function*() {
12 throw new Test262Error();
13 }());
14 var iterationCount = 0;
15
16 assert.throws(Test262Error, function() {
17 for (var x of iterable) {
18 iterationCount += 1;
19 }
20 });
21
22 assert.sameValue(iterationCount, 0, 'The loop body is not evaluated');
23
24 reportCompare(0, 0);