Chromium Code Reviews| Index: test/mjsunit/harmony/function-sent.js |
| diff --git a/test/mjsunit/harmony/function-sent.js b/test/mjsunit/harmony/function-sent.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f0e26b6e411a3391a5b9460de425e1e8f10282f1 |
| --- /dev/null |
| +++ b/test/mjsunit/harmony/function-sent.js |
| @@ -0,0 +1,46 @@ |
| +// Copyright 2016 the V8 project authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +// Flags: --harmony-function-sent |
| + |
|
rossberg
2016/01/22 14:13:06
Add tests using yield*.
neis
2016/01/27 16:49:40
Done.
|
| + |
| +{ |
| + function* g() { return function.sent } |
| + assertEquals({value: 42, done: true}, g().next(42)); |
| +} |
| + |
| + |
| +{ |
| + function* g() { |
| + try { |
| + yield function.sent; |
| + yield function.sent; |
| + } finally { |
| + return function.sent; |
|
rossberg
2016/01/22 14:13:06
Maybe also have a test that yields in the finally
neis
2016/01/27 16:49:40
Done.
|
| + } |
| + } |
| + |
| + |
| + { |
| + x = g(); |
| + assertEquals({value: 1, done: false}, x.next(1)); |
| + assertEquals({value: 2, done: false}, x.next(2)); |
| + assertEquals({value: 3, done: true}, x.next(3)); |
| + } |
| + |
| + |
| + { |
| + x = g(); |
| + assertEquals({value: 1, done: false}, x.next(1)); |
| + assertEquals({value: 2, done: true}, x.throw(2)); |
| + } |
| +} |
| + |
|
rossberg
2016/01/22 14:13:06
Once there is 'return', we should probably have mo
|
| + |
| +assertThrows("function f() { return function.sent }", SyntaxError); |
| +assertThrows("() => { return function.sent }", SyntaxError); |
| +assertThrows("() => { function.sent }", SyntaxError); |
| +assertThrows("() => function.sent", SyntaxError); |
| +assertThrows("({*f() { function.sent }})", SyntaxError); |
| +assertDoesNotThrow("({*f() { return function.sent }})"); |