diff options
Diffstat (limited to 'deps/v8/test/mjsunit/harmony/generators.js')
-rw-r--r-- | deps/v8/test/mjsunit/harmony/generators.js | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/deps/v8/test/mjsunit/harmony/generators.js b/deps/v8/test/mjsunit/harmony/generators.js index 5b045049e9..df6cec8925 100644 --- a/deps/v8/test/mjsunit/harmony/generators.js +++ b/deps/v8/test/mjsunit/harmony/generators.js @@ -237,8 +237,8 @@ let x = g(); assertEquals({value: 1, done: false}, x.next()); assertEquals({value: 42, done: false}, x.next()); - assertEquals({value: 43, done: false}, x.return(666)); - assertEquals({value: undefined, done: false}, x.next()); + assertEquals({value: 43, done: false}, x.return(44)); + assertEquals({value: 44, done: false}, x.next()); assertEquals({value: undefined, done: true}, x.next()); } @@ -250,3 +250,23 @@ assertThrowsEquals(() => x.next(), 666); } } + + +{ // yield*, .return argument is final result + + function* inner() { + yield 2; + } + + function* g() { + yield 1; + return yield* inner(); + } + + { + let x = g(); + assertEquals({value: 1, done: false}, x.next()); + assertEquals({value: 2, done: false}, x.next()); + assertEquals({value: 42, done: true}, x.return(42)); + } +} |