OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 the V8 project authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 // Flags: --harmony-function-sent | |
6 | |
rossberg
2016/01/22 14:13:06
Add tests using yield*.
neis
2016/01/27 16:49:40
Done.
| |
7 | |
8 { | |
9 function* g() { return function.sent } | |
10 assertEquals({value: 42, done: true}, g().next(42)); | |
11 } | |
12 | |
13 | |
14 { | |
15 function* g() { | |
16 try { | |
17 yield function.sent; | |
18 yield function.sent; | |
19 } finally { | |
20 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.
| |
21 } | |
22 } | |
23 | |
24 | |
25 { | |
26 x = g(); | |
27 assertEquals({value: 1, done: false}, x.next(1)); | |
28 assertEquals({value: 2, done: false}, x.next(2)); | |
29 assertEquals({value: 3, done: true}, x.next(3)); | |
30 } | |
31 | |
32 | |
33 { | |
34 x = g(); | |
35 assertEquals({value: 1, done: false}, x.next(1)); | |
36 assertEquals({value: 2, done: true}, x.throw(2)); | |
37 } | |
38 } | |
39 | |
rossberg
2016/01/22 14:13:06
Once there is 'return', we should probably have mo
| |
40 | |
41 assertThrows("function f() { return function.sent }", SyntaxError); | |
42 assertThrows("() => { return function.sent }", SyntaxError); | |
43 assertThrows("() => { function.sent }", SyntaxError); | |
44 assertThrows("() => function.sent", SyntaxError); | |
45 assertThrows("({*f() { function.sent }})", SyntaxError); | |
46 assertDoesNotThrow("({*f() { return function.sent }})"); | |
OLD | NEW |