| ... | @@ -8990,8 +8990,7 @@ pub fn assert(ok: bool) void { | ... | @@ -8990,8 +8990,7 @@ pub fn assert(ok: bool) void { |
| 8990 | This means that when testing in ReleaseFast or ReleaseSmall mode, {#syntax#}assert{#endsyntax#} | 8990 | This means that when testing in ReleaseFast or ReleaseSmall mode, {#syntax#}assert{#endsyntax#} |
| 8991 | is not sufficient to check the result of a computation: | 8991 | is not sufficient to check the result of a computation: |
| 8992 | </p> | 8992 | </p> |
| 8993 | {#code_begin|test|assert#} | 8993 | {#code_begin|syntax#} |
| 8994 | {#code_release_fast#} | | |
| 8995 | const std = @import("std"); | 8994 | const std = @import("std"); |
| 8996 | const assert = std.debug.assert; | 8995 | const assert = std.debug.assert; |
| 8997 | | 8996 | |
| ... | @@ -8999,9 +8998,11 @@ test "assert in release fast mode" { | ... | @@ -8999,9 +8998,11 @@ test "assert in release fast mode" { |
| 8999 | assert(false); | 8998 | assert(false); |
| 9000 | } | 8999 | } |
| 9001 | {#code_end#} | 9000 | {#code_end#} |
| 9002 | <p>Note that although the above example shows the test passing, this is invoking | 9001 | <p> |
| 9003 | unchecked {#link|Undefined Behavior#}. This documentation is showing only one possible | 9002 | When compiling this test in {#link|ReleaseFast#} mode, it invokes unchecked |
| 9004 | outcome of this test.</p> | 9003 | {#link|Undefined Behavior#}. Since that could do anything, this documentation |
| | 9004 | cannot show you the output. |
| | 9005 | </p> |
| 9005 | <p> | 9006 | <p> |
| 9006 | Better practice for checking the output when testing is to use {#syntax#}std.testing.expect{#endsyntax#}: | 9007 | Better practice for checking the output when testing is to use {#syntax#}std.testing.expect{#endsyntax#}: |
| 9007 | </p> | 9008 | </p> |