mirror of
https://github.com/ziglang/zig.git
synced 2024-11-27 15:42:49 +00:00
29 lines
803 B
Zig
29 lines
803 B
Zig
const builtin = @import("builtin");
|
|
const expect = @import("std").testing.expect;
|
|
|
|
fn foo(id: u64) !i32 {
|
|
return switch (id) {
|
|
1 => getErrInt(),
|
|
2 => {
|
|
const size = try getErrInt();
|
|
_ = size;
|
|
return try getErrInt();
|
|
},
|
|
else => error.ItBroke,
|
|
};
|
|
}
|
|
|
|
fn getErrInt() anyerror!i32 {
|
|
return 0;
|
|
}
|
|
|
|
test "ir block deps" {
|
|
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
|
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
|
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
|
|
if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
|
|
|
|
try expect((foo(1) catch unreachable) == 0);
|
|
try expect((foo(2) catch unreachable) == 0);
|
|
}
|