Skip to content

Commit aaf593f

Browse files
oulgenfacebook-github-bot
authored andcommitted
Add a new test to exercise async generators in the unwinder
Summary: Would have caught the bug in D20287874 Reviewed By: ricklavoie Differential Revision: D20372127 fbshipit-source-id: bab667c8cecce7b66d38e1a11802d8bdbdda6213
1 parent 220d07a commit aaf593f

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?hh
2+
3+
class C {
4+
public static int $x = 0;
5+
}
6+
7+
function handler($what, $fun) {
8+
if ($fun == 'foo' && $what == 'exit') {
9+
if (C::$x == 1) {
10+
exit(1);
11+
}
12+
C::$x = 1;
13+
}
14+
}
15+
16+
async function foo() {
17+
echo "enter\n";
18+
$x = RescheduleWaitHandle::create(0, 0);
19+
await $x;
20+
yield null;
21+
}
22+
23+
<<__EntryPoint>>
24+
async function main() {
25+
fb_setprofile('handler');
26+
foreach (foo() await as $_) {}
27+
echo "NOOOOO!\n";
28+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
enter

0 commit comments

Comments
 (0)