Chromium Code Reviews| Index: test/mjsunit/es6/generators-states.js |
| diff --git a/test/mjsunit/es6/generators-states.js b/test/mjsunit/es6/generators-states.js |
| index 0a2173a919fb9d24eadb1cc90dd6f29641d67822..d061dcda9fca45665ff948323f2849965a5d4bc6 100644 |
| --- a/test/mjsunit/es6/generators-states.js |
| +++ b/test/mjsunit/es6/generators-states.js |
| @@ -25,6 +25,7 @@ function* throwGenerator() { yield iter.throw(new Bar); } |
| // Throw on a suspendedStart iterator. |
| iter = nextGenerator(); |
| assertThrows(function() { iter.throw(new Foo) }, Foo) |
| +assertIteratorIsClosed(iter); |
| assertThrows(function() { iter.throw(new Foo) }, Foo) |
| assertIteratorIsClosed(iter); |
| @@ -65,3 +66,20 @@ iter = (function* () { |
| assertIteratorResult(3, false, iter.next()); |
| assertIteratorResult(4, false, iter.next()); |
| assertIteratorIsClosed(iter); |
| + |
| + |
| +// return that doesn't close |
|
Michael Starzinger
2016/01/25 12:56:05
nit: Please capitalize and punctuate comment.
|
| +{ |
| + let g = function*() { try {return 42} finally {yield 43} }; |
| + |
| + let x = g(); |
| + assertEquals({value: 43, done: false}, x.next()); |
| + assertEquals({value: 42, done: true}, x.next()); |
| +} |
| +{ |
| + let x; |
| + let g = function*() { try {return 42} finally {x.throw(666)} }; |
|
Michael Starzinger
2016/01/25 12:56:05
As discussed offline, can we add another test case
|
| + |
| + x = g(); |
| + assertThrows(() => x.next(), TypeError); // still executing |
| +} |