authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-10-09 09:04:42+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-10-10 08:36:08+02:00
log4fb39f82c2a5a57b497c741093e95e1e8e1a57fe
tree0f518551ab70a3f5618420c26b9dc9e3a902dcc2
parent40a50f5e2cd4900d2b3d13b353b18a8b6ae052af
signature Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

test: move some test-standalone simple tests to test-cases


9 files changed, 49 insertions(+), 37 deletions(-)

test/cases/main_return_error_u8.zig created+8
...@@ -0,0 +1,8 @@
1const Err = error{Foo};
2
3pub fn main() !u8 {
4 return Err.Foo;
5}
6
7// compile
8// output_mode=Exe
test/cases/main_return_error_u8_non_zero.zig created+13
...@@ -0,0 +1,13 @@
1const Err = error{Foo};
2
3fn foo() u8 {
4 return @intCast(9);
5}
6
7pub fn main() !u8 {
8 if (foo() == 7) return Err.Foo;
9 return 123;
10}
11
12// compile
13// output_mode=Exe
test/cases/noreturn_call_as_arg.zig created+13
...@@ -0,0 +1,13 @@
1const std = @import("std");
2
3fn foo() noreturn {
4 std.process.exit(0);
5}
6
7fn bar(_: u8, _: u8) void {}
8
9pub fn main() void {
10 bar(foo(), @compileError("bad"));
11}
12
13// run
test/cases/noreturn_call_inline.zig created+15
...@@ -0,0 +1,15 @@
1const std = @import("std");
2
3pub fn main() void {
4 _ = bar();
5}
6
7inline fn bar() u8 {
8 noret();
9}
10
11inline fn noret() noreturn {
12 std.process.exit(0);
13}
14
15// run
test/standalone/simple/build.zig-4
...@@ -105,9 +105,5 @@ const cases = [_]Case{...@@ -105,9 +105,5 @@ const cases = [_]Case{
105 },105 },
106 },106 },
107 .{ .src_path = "guess_number/main.zig" },107 .{ .src_path = "guess_number/main.zig" },
108 .{ .src_path = "main_return_error/error_u8.zig" },
109 .{ .src_path = "main_return_error/error_u8_non_zero.zig" },
110 .{ .src_path = "noreturn_call/inline.zig" },
111 .{ .src_path = "noreturn_call/as_arg.zig" },
112 .{ .src_path = "std_enums_big_enums.zig" },108 .{ .src_path = "std_enums_big_enums.zig" },
113};109};
test/standalone/simple/main_return_error/error_u8.zig deleted-5
...@@ -1,5 +0,0 @@
1const Err = error{Foo};
2
3pub fn main() !u8 {
4 return Err.Foo;
5}
test/standalone/simple/main_return_error/error_u8_non_zero.zig deleted-10
...@@ -1,10 +0,0 @@
1const Err = error{Foo};
2
3fn foo() u8 {
4 return @intCast(9);
5}
6
7pub fn main() !u8 {
8 if (foo() == 7) return Err.Foo;
9 return 123;
10}
test/standalone/simple/noreturn_call/as_arg.zig deleted-8
...@@ -1,8 +0,0 @@
1const std = @import("std");
2fn foo() noreturn {
3 std.process.exit(0);
4}
5fn bar(_: u8, _: u8) void {}
6pub fn main() void {
7 bar(foo(), @compileError("bad"));
8}
test/standalone/simple/noreturn_call/inline.zig deleted-10
...@@ -1,10 +0,0 @@
1pub fn main() void {
2 _ = bar();
3}
4inline fn bar() u8 {
5 noret();
6}
7const std = @import("std");
8inline fn noret() noreturn {
9 std.process.exit(0);
10}