aboutsummaryrefslogtreecommitdiff
path: root/doc/langref/test_assertion_failure.zig
blob: a10bfc095b2e212abd3be4c9d3ed170f501fa16e (plain)
1
2
3
4
5
6
7
8
9
10
11
// 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=