diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2019-08-16 13:00:48 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2019-08-16 13:07:07 -0400 |
| commit | 5a2cbe239f4299b4412209148131a501ec023ceb (patch) | |
| tree | 1652cb4c4bed1849f818979dd5d41d3a27ede5d3 /test | |
| parent | 2cb1f93894be3f48f0c49004515fa5e8190f69d9 (diff) | |
| download | zig-5a2cbe239f4299b4412209148131a501ec023ceb.tar.gz zig-5a2cbe239f4299b4412209148131a501ec023ceb.zip | |
fix and test case for returning from suspend block
See #3063
Diffstat (limited to 'test')
| -rw-r--r-- | test/stage1/behavior/async_fn.zig | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/stage1/behavior/async_fn.zig b/test/stage1/behavior/async_fn.zig index b5e1d3a63f..fea713b725 100644 --- a/test/stage1/behavior/async_fn.zig +++ b/test/stage1/behavior/async_fn.zig @@ -760,3 +760,17 @@ test "async call a generic function" { }; _ = async S.doTheTest(); } + +test "return from suspend block" { + const S = struct { + fn doTheTest() void { + expect(func() == 1234); + } + fn func() i32 { + suspend { + return 1234; + } + } + }; + _ = async S.doTheTest(); +} |
