update tests for nosuspend
parent
af00afed98
commit
2c9204032d
|
@ -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",
|
"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 {
|
\\export fn entry() void {
|
||||||
\\ noasync {
|
\\ nosuspend {
|
||||||
\\ const bar = async foo();
|
\\ const bar = async foo();
|
||||||
\\ suspend;
|
\\ suspend;
|
||||||
\\ resume bar;
|
\\ resume bar;
|
||||||
|
@ -253,9 +253,9 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
|
||||||
\\}
|
\\}
|
||||||
\\fn foo() void {}
|
\\fn foo() void {}
|
||||||
, &[_][]const u8{
|
, &[_][]const u8{
|
||||||
"tmp.zig:3:21: error: async call in noasync scope",
|
"tmp.zig:3:21: error: async call in nosuspend scope",
|
||||||
"tmp.zig:4:9: error: suspend in noasync scope",
|
"tmp.zig:4:9: error: suspend in nosuspend scope",
|
||||||
"tmp.zig:5:9: error: resume in noasync scope",
|
"tmp.zig:5:9: error: resume in nosuspend scope",
|
||||||
});
|
});
|
||||||
|
|
||||||
cases.add("atomicrmw with bool op not .Xchg",
|
cases.add("atomicrmw with bool op not .Xchg",
|
||||||
|
|
|
@ -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 {
|
\\pub fn panic(message: []const u8, stack_trace: ?*@import("builtin").StackTrace) noreturn {
|
||||||
\\ @import("std").os.exit(126);
|
\\ @import("std").os.exit(126);
|
||||||
\\}
|
\\}
|
||||||
\\pub fn main() void {
|
\\pub fn main() void {
|
||||||
\\ _ = noasync add(101, 100);
|
\\ _ = nosuspend add(101, 100);
|
||||||
\\}
|
\\}
|
||||||
\\fn add(a: i32, b: i32) i32 {
|
\\fn add(a: i32, b: i32) i32 {
|
||||||
\\ if (a > 100) {
|
\\ if (a > 100) {
|
||||||
|
|
|
@ -1090,7 +1090,7 @@ test "recursive call of await @asyncCall with struct return type" {
|
||||||
expect(res.z == 3);
|
expect(res.z == 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
test "noasync function call" {
|
test "nosuspend function call" {
|
||||||
const S = struct {
|
const S = struct {
|
||||||
fn doTheTest() void {
|
fn doTheTest() void {
|
||||||
const result = nosuspend add(50, 100);
|
const result = nosuspend add(50, 100);
|
||||||
|
@ -1511,7 +1511,7 @@ test "take address of temporary async frame" {
|
||||||
S.doTheTest();
|
S.doTheTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
test "noasync await" {
|
test "nosuspend await" {
|
||||||
const S = struct {
|
const S = struct {
|
||||||
var finished = false;
|
var finished = false;
|
||||||
|
|
||||||
|
@ -1532,7 +1532,7 @@ test "noasync await" {
|
||||||
expect(S.finished);
|
expect(S.finished);
|
||||||
}
|
}
|
||||||
|
|
||||||
test "noasync on function calls" {
|
test "nosuspend on function calls" {
|
||||||
const S0 = struct {
|
const S0 = struct {
|
||||||
b: i32 = 42,
|
b: i32 = 42,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue