zig/doc/langref/test_comptime_unwrap_error.zig

11 lines
217 B
Zig

comptime {
const number = getNumberOrFail() catch unreachable;
_ = number;
}
fn getNumberOrFail() !i32 {
return error.UnableToReturnNumber;
}
// test_error=caught unexpected error 'UnableToReturnNumber'