Commit 30c4add85a

Andrew Kelley <superjoe30@gmail.com>
2018-07-12 02:17:47
std.event.Future: workaround in tests for llvm coro memory
See #1194
1 parent 9751a0a
Changed files (2)
std/event/future.zig
@@ -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();
 }
std/event.zig
@@ -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");