authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-07-20 13:59:18-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-07-20 13:59:18-04:00
loga2e1be0346c364c4327dc2b81bbcdeca12414dab
tree36c6f9997730a7dcc59ebfcd2ceca7fb3a687d4b
parent2c1e955de7a8f31666c751ce4f69c47d4c1b822e
signaturelock-open Commit is signed but in an unrecognized format.

docs: don't try to run the undefined behavior example test


1 files changed, 6 insertions(+), 5 deletions(-)

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