zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 2c9204032d1c839d8d577113a9c4def4b9ea9b94 (tree)
parent af00afed9844b9fb17478d33840fb4a312c4f07c
Author: Tadeo Kondrak <me@tadeo.ca>
Date:   Tue,  5 May 2020 05:18:29 -0600

update tests for nosuspend

Diffstat:
Mtest/compile_errors.zig | 10+++++-----
Mtest/runtime_safety.zig | 4++--
Mtest/stage1/behavior/async_fn.zig | 6+++---
3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/test/compile_errors.zig b/test/compile_errors.zig @@ -243,9 +243,9 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { "tmp.zig:17:17: error: RHS of shift is too large for LHS type", }); - cases.addTest("combination of noasync and async", + cases.addTest("combination of nosuspend and async", \\export fn entry() void { - \\ noasync { + \\ nosuspend { \\ const bar = async foo(); \\ suspend; \\ resume bar; @@ -253,9 +253,9 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { \\} \\fn foo() void {} , &[_][]const u8{ - "tmp.zig:3:21: error: async call in noasync scope", - "tmp.zig:4:9: error: suspend in noasync scope", - "tmp.zig:5:9: error: resume in noasync scope", + "tmp.zig:3:21: error: async call in nosuspend scope", + "tmp.zig:4:9: error: suspend in nosuspend scope", + "tmp.zig:5:9: error: resume in nosuspend scope", }); cases.add("atomicrmw with bool op not .Xchg", diff --git a/test/runtime_safety.zig b/test/runtime_safety.zig @@ -234,12 +234,12 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { \\} ); - cases.addRuntimeSafety("noasync function call, callee suspends", + cases.addRuntimeSafety("nosuspend function call, callee suspends", \\pub fn panic(message: []const u8, stack_trace: ?*@import("builtin").StackTrace) noreturn { \\ @import("std").os.exit(126); \\} \\pub fn main() void { - \\ _ = noasync add(101, 100); + \\ _ = nosuspend add(101, 100); \\} \\fn add(a: i32, b: i32) i32 { \\ if (a > 100) { diff --git a/test/stage1/behavior/async_fn.zig b/test/stage1/behavior/async_fn.zig @@ -1090,7 +1090,7 @@ test "recursive call of await @asyncCall with struct return type" { expect(res.z == 3); } -test "noasync function call" { +test "nosuspend function call" { const S = struct { fn doTheTest() void { const result = nosuspend add(50, 100); @@ -1511,7 +1511,7 @@ test "take address of temporary async frame" { S.doTheTest(); } -test "noasync await" { +test "nosuspend await" { const S = struct { var finished = false; @@ -1532,7 +1532,7 @@ test "noasync await" { expect(S.finished); } -test "noasync on function calls" { +test "nosuspend on function calls" { const S0 = struct { b: i32 = 42, };