mirror of
https://github.com/ziglang/zig.git
synced 2024-11-27 23:52:31 +00:00
a35b366eb6
start using zig-fmt-pointer-reform branch build of zig fmt to fix code to use the new syntax all of test/cases/* are processed, but there are more left to be done - all the std lib used by the behavior tests
22 lines
423 B
Zig
22 lines
423 B
Zig
const assert = @import("std").debug.assert;
|
|
|
|
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;
|
|
}
|
|
|
|
test "ir block deps" {
|
|
assert((foo(1) catch unreachable) == 0);
|
|
assert((foo(2) catch unreachable) == 0);
|
|
}
|