Skip to content

Commit

Permalink
add test for async call of generic function
Browse files Browse the repository at this point in the history
See #3063
  • Loading branch information
andrewrk committed Aug 16, 2019
1 parent 5df89da commit 4ea2331
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/stage1/behavior/async_fn.zig
Original file line number Diff line number Diff line change
Expand Up @@ -740,3 +740,23 @@ test "no reason to resolve frame still works" {
fn simpleNothing() void {
var x: i32 = 1234;
}

test "async call a generic function" {
const S = struct {
fn doTheTest() void {
var f = async func(i32, 2);
const result = await f;
expect(result == 3);
}

fn func(comptime T: type, inc: T) T {
var x: T = 1;
suspend {
resume @frame();
}
x += inc;
return x;
}
};
_ = async S.doTheTest();
}

0 comments on commit 4ea2331

Please sign in to comment.