zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

test_assertion_failure.zig (236B) - Raw


      1 // This is how std.debug.assert is implemented
      2 fn assert(ok: bool) void {
      3     if (!ok) unreachable; // assertion failure
      4 }
      5 
      6 // This test will fail because we hit unreachable.
      7 test "this will fail" {
      8     assert(false);
      9 }
     10 
     11 // test_error=