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
signature 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 {...@@ -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#}
8995const std = @import("std");8994const std = @import("std");
8996const assert = std.debug.assert;8995const assert = std.debug.assert;
89978996
...@@ -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 invoking9001 <p>
9003 unchecked {#link|Undefined Behavior#}. This documentation is showing only one possible9002 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>