zig/test/cases/ir_block_deps.zig

22 lines
423 B
Zig
Raw Normal View History

2017-01-05 00:57:48 -08:00
const assert = @import("std").debug.assert;
2018-01-31 19:48:40 -08:00
fn foo(id: u64) !i32 {
return switch (id) {
1 => getErrInt(),
2 => {
const size = try getErrInt();
return try getErrInt();
},
else => error.ItBroke,
};
}
fn getErrInt() error!i32 {
return 0;
}
2017-05-23 18:38:31 -07:00
test "ir block deps" {
assert((foo(1) catch unreachable) == 0);
assert((foo(2) catch unreachable) == 0);
}