authorgravatar for me@tadeo.caTadeo Kondrak <me@tadeo.ca> 2020-05-05 05:18:29-06:00
committergravatar for me@tadeo.caTadeo Kondrak <me@tadeo.ca> 2020-05-05 05:55:26-06:00
log2c9204032d1c839d8d577113a9c4def4b9ea9b94
tree0e8776be19c1552380dca6f5916e304a77de0773
parentaf00afed9844b9fb17478d33840fb4a312c4f07c
signature Commit is signed but in an unrecognized format.

update tests for nosuspend


3 files changed, 10 insertions(+), 10 deletions(-)

test/compile_errors.zig+5-5
...@@ -243,9 +243,9 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {...@@ -243,9 +243,9 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
243 "tmp.zig:17:17: error: RHS of shift is too large for LHS type",243 "tmp.zig:17:17: error: RHS of shift is too large for LHS type",
244 });244 });
245245
246 cases.addTest("combination of noasync and async",246 cases.addTest("combination of nosuspend and async",
247 \\export fn entry() void {247 \\export fn entry() void {
248 \\ noasync {248 \\ nosuspend {
249 \\ const bar = async foo();249 \\ const bar = async foo();
250 \\ suspend;250 \\ suspend;
251 \\ resume bar;251 \\ resume bar;
...@@ -253,9 +253,9 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {...@@ -253,9 +253,9 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
253 \\}253 \\}
254 \\fn foo() void {}254 \\fn foo() void {}
255 , &[_][]const u8{255 , &[_][]const u8{
256 "tmp.zig:3:21: error: async call in noasync scope",256 "tmp.zig:3:21: error: async call in nosuspend scope",
257 "tmp.zig:4:9: error: suspend in noasync scope",257 "tmp.zig:4:9: error: suspend in nosuspend scope",
258 "tmp.zig:5:9: error: resume in noasync scope",258 "tmp.zig:5:9: error: resume in nosuspend scope",
259 });259 });
260260
261 cases.add("atomicrmw with bool op not .Xchg",261 cases.add("atomicrmw with bool op not .Xchg",
test/runtime_safety.zig+2-2
...@@ -234,12 +234,12 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {...@@ -234,12 +234,12 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
234 \\}234 \\}
235 );235 );
236236
237 cases.addRuntimeSafety("noasync function call, callee suspends",237 cases.addRuntimeSafety("nosuspend function call, callee suspends",
238 \\pub fn panic(message: []const u8, stack_trace: ?*@import("builtin").StackTrace) noreturn {238 \\pub fn panic(message: []const u8, stack_trace: ?*@import("builtin").StackTrace) noreturn {
239 \\ @import("std").os.exit(126);239 \\ @import("std").os.exit(126);
240 \\}240 \\}
241 \\pub fn main() void {241 \\pub fn main() void {
242 \\ _ = noasync add(101, 100);242 \\ _ = nosuspend add(101, 100);
243 \\}243 \\}
244 \\fn add(a: i32, b: i32) i32 {244 \\fn add(a: i32, b: i32) i32 {
245 \\ if (a > 100) {245 \\ if (a > 100) {
test/stage1/behavior/async_fn.zig+3-3
...@@ -1090,7 +1090,7 @@ test "recursive call of await @asyncCall with struct return type" {...@@ -1090,7 +1090,7 @@ test "recursive call of await @asyncCall with struct return type" {
1090 expect(res.z == 3);1090 expect(res.z == 3);
1091}1091}
10921092
1093test "noasync function call" {1093test "nosuspend function call" {
1094 const S = struct {1094 const S = struct {
1095 fn doTheTest() void {1095 fn doTheTest() void {
1096 const result = nosuspend add(50, 100);1096 const result = nosuspend add(50, 100);
...@@ -1511,7 +1511,7 @@ test "take address of temporary async frame" {...@@ -1511,7 +1511,7 @@ test "take address of temporary async frame" {
1511 S.doTheTest();1511 S.doTheTest();
1512}1512}
15131513
1514test "noasync await" {1514test "nosuspend await" {
1515 const S = struct {1515 const S = struct {
1516 var finished = false;1516 var finished = false;
15171517
...@@ -1532,7 +1532,7 @@ test "noasync await" {...@@ -1532,7 +1532,7 @@ test "noasync await" {
1532 expect(S.finished);1532 expect(S.finished);
1533}1533}
15341534
1535test "noasync on function calls" {1535test "nosuspend on function calls" {
1536 const S0 = struct {1536 const S0 = struct {
1537 b: i32 = 42,1537 b: i32 = 42,
1538 };1538 };