diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/compile_errors.zig | 12 | ||||
| -rw-r--r-- | test/runtime_safety.zig | 4 | ||||
| -rw-r--r-- | test/stage1/behavior/error.zig | 4 |
3 files changed, 16 insertions, 4 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig index e1e3f715c2..57e2504e5e 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -3,6 +3,18 @@ const builtin = @import("builtin"); pub fn addCases(cases: *tests.CompileErrorContext) void { cases.add( + "discarding error value", + \\export fn entry() void { + \\ _ = foo(); + \\} + \\fn foo() !void { + \\ return error.OutOfMemory; + \\} + , + "tmp.zig:2:7: error: error is discarded", + ); + + cases.add( "volatile on global assembly", \\comptime { \\ asm volatile (""); diff --git a/test/runtime_safety.zig b/test/runtime_safety.zig index 0427efabd5..2d153ccff0 100644 --- a/test/runtime_safety.zig +++ b/test/runtime_safety.zig @@ -370,7 +370,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { \\ @import("std").os.exit(126); \\} \\pub fn main() void { - \\ _ = bar(9999); + \\ bar(9999) catch {}; \\} \\fn bar(x: u16) anyerror { \\ return @intToError(x); @@ -384,7 +384,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { \\const Set1 = error{A, B}; \\const Set2 = error{A, C}; \\pub fn main() void { - \\ _ = foo(Set1.B); + \\ foo(Set1.B) catch {}; \\} \\fn foo(set1: Set1) Set2 { \\ return @errSetCast(Set2, set1); diff --git a/test/stage1/behavior/error.zig b/test/stage1/behavior/error.zig index 7d9dae7bdd..babefba6f5 100644 --- a/test/stage1/behavior/error.zig +++ b/test/stage1/behavior/error.zig @@ -205,8 +205,8 @@ fn foo2(f: fn () anyerror!void) void { fn bar2() (error{}!void) {} test "error: Zero sized error set returned with value payload crash" { - _ = foo3(0); - _ = comptime foo3(0); + _ = foo3(0) catch {}; + _ = comptime foo3(0) catch {}; } const Error = error{}; |
