diff options
| author | Jacob G-W <jacoblevgw@gmail.com> | 2021-06-09 21:35:42 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-06-21 17:03:03 -0700 |
| commit | 641ecc260f43ffb2398acb80cbd141535dbbb03d (patch) | |
| tree | 87455d3b460f517ad35bcda2b3a2e38599dd4aa1 /test/behavior/async_fn.zig | |
| parent | d34a1ccb0ea75ba31f374b8b2d34e18326b147b1 (diff) | |
| download | zig-641ecc260f43ffb2398acb80cbd141535dbbb03d.tar.gz zig-641ecc260f43ffb2398acb80cbd141535dbbb03d.zip | |
std, src, doc, test: remove unused variables
Diffstat (limited to 'test/behavior/async_fn.zig')
| -rw-r--r-- | test/behavior/async_fn.zig | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/behavior/async_fn.zig b/test/behavior/async_fn.zig index b0e6c548ed..f0d47fbc7f 100644 --- a/test/behavior/async_fn.zig +++ b/test/behavior/async_fn.zig @@ -13,6 +13,7 @@ test "simple coroutine suspend and resume" { resume frame; try expect(global_x == 3); const af: anyframe->void = &frame; + _ = af; resume frame; try expect(global_x == 4); } @@ -45,6 +46,7 @@ test "suspend at end of function" { fn doTheTest() !void { try expect(x == 1); const p = async suspendAtEnd(); + _ = p; try expect(x == 2); } @@ -132,6 +134,7 @@ test "@frameSize" { } fn other(param: i32) void { var local: i32 = undefined; + _ = local; suspend {} } }; @@ -181,6 +184,7 @@ test "coroutine suspend, resume" { test "coroutine suspend with block" { const p = async testSuspendBlock(); + _ = p; try expect(!global_result); resume a_promise; try expect(global_result); @@ -207,6 +211,7 @@ var await_final_result: i32 = 0; test "coroutine await" { await_seq('a'); var p = async await_amain(); + _ = p; await_seq('f'); resume await_a_promise; await_seq('i'); @@ -243,6 +248,7 @@ var early_final_result: i32 = 0; test "coroutine await early return" { early_seq('a'); var p = async early_amain(); + _ = p; early_seq('f'); try expect(early_final_result == 1234); try expect(std.mem.eql(u8, &early_points, "abcdef")); @@ -276,6 +282,7 @@ test "async function with dot syntax" { } }; const p = async S.foo(); + _ = p; try expect(S.y == 2); } @@ -362,11 +369,13 @@ test "error return trace across suspend points - early return" { const p = nonFailing(); resume p; const p2 = async printTrace(p); + _ = p2; } test "error return trace across suspend points - async return" { const p = nonFailing(); const p2 = async printTrace(p); + _ = p2; resume p; } @@ -396,6 +405,7 @@ fn printTrace(p: anyframe->(anyerror!void)) callconv(.Async) void { test "break from suspend" { var my_result: i32 = 1; const p = async testBreakFromSuspend(&my_result); + _ = p; try std.testing.expect(my_result == 2); } fn testBreakFromSuspend(my_result: *i32) callconv(.Async) void { @@ -619,6 +629,7 @@ test "returning a const error from async function" { fn amain() !void { var download_frame = async fetchUrl(10, "a string"); const download_text = try await download_frame; + _ = download_text; @panic("should not get here"); } @@ -730,6 +741,7 @@ test "alignment of local variables in async functions" { const S = struct { fn doTheTest() !void { var y: u8 = 123; + _ = y; var x: u8 align(128) = 1; try expect(@ptrToInt(&x) % 128 == 0); } @@ -742,6 +754,7 @@ test "no reason to resolve frame still works" { } fn simpleNothing() void { var x: i32 = 1234; + _ = x; } test "async call a generic function" { @@ -802,6 +815,7 @@ test "struct parameter to async function is copied to the frame" { if (x == 0) return; clobberStack(x - 1); var y: i32 = x; + _ = y; } fn bar(f: *@Frame(foo)) void { @@ -1654,6 +1668,7 @@ test "@asyncCall with pass-by-value arguments" { [_]u8{ 1, 2, 3, 4, 5 }, F2, }); + _ = frame_ptr; } test "@asyncCall with arguments having non-standard alignment" { @@ -1673,4 +1688,5 @@ test "@asyncCall with arguments having non-standard alignment" { // The function pointer must not be comptime-known. var t = S.f; var frame_ptr = @asyncCall(&buffer, {}, t, .{ F0, undefined, F1 }); + _ = frame_ptr; } |
