blob: 4708af87f4bd27060125a8e2c0e111e0996badab (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
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_arm) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
try expect((foo(1) catch unreachable) == 0);
try expect((foo(2) catch unreachable) == 0);
}
|