zig/doc/langref/test_assertion_failure.zig

12 lines
236 B
Zig
Raw Normal View History

// This is how std.debug.assert is implemented
fn assert(ok: bool) void {
if (!ok) unreachable; // assertion failure
}
// This test will fail because we hit unreachable.
test "this will fail" {
assert(false);
}
// test_error=