std.event.Future: workaround in tests for llvm coro memory

See #1194
This commit is contained in:
Andrew Kelley 2018-07-11 20:17:47 -04:00
parent 9751a0ae04
commit 30c4add85a
2 changed files with 10 additions and 1 deletions

View File

@ -4,7 +4,7 @@ pub const Lock = @import("event/lock.zig").Lock;
pub const tcp = @import("event/tcp.zig");
pub const Channel = @import("event/channel.zig").Channel;
pub const Group = @import("event/group.zig").Group;
pub const Future = @import("event/future.zig").Group;
pub const Future = @import("event/future.zig").Future;
test "import event tests" {
_ = @import("event/locked.zig");

View File

@ -67,6 +67,9 @@ test "std.event.Future" {
}
async fn testFuture(loop: *Loop) void {
suspend |p| {
resume p;
}
var future = Future(i32).init(loop);
const a = async waitOnFuture(&future) catch @panic("memory");
@ -79,10 +82,16 @@ async fn testFuture(loop: *Loop) void {
}
async fn waitOnFuture(future: *Future(i32)) i32 {
suspend |p| {
resume p;
}
return (await (async future.get() catch @panic("memory"))).*;
}
async fn resolveFuture(future: *Future(i32)) void {
suspend |p| {
resume p;
}
future.data = 6;
future.resolve();
}