diff options
| author | Paul Espinosa <mrpaul@aestheticwisdom.com> | 2020-07-11 09:27:26 +0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-10-22 15:54:57 -0700 |
| commit | ddd39b994b1eb9751d06227c6db02f15a5f71e9f (patch) | |
| tree | 0ca901104b628f09ed01446a260daef11a0e9c42 /src | |
| parent | 1e13e8e8172c1409c5152e8b4e935c5a1d31704b (diff) | |
| download | zig-ddd39b994b1eb9751d06227c6db02f15a5f71e9f.tar.gz zig-ddd39b994b1eb9751d06227c6db02f15a5f71e9f.zip | |
Use std.testing.expect in language reference samples
In this commit, the code samples in the language reference have been changed to
use `std.testing.expect` rather than `std.debug.assert` when they are
written in `test` code. This will teach Zig learners best practices when
they write their own test code.
Not all uses of `std.debug.assert` have been replaced. There are examples where
using `assert` fits the context of the sample.
Using `std.debug.assert` in test code can lead to errors if running tests in
ReleaseFast mode. In ReleaseFast mode, the `unreachable` in `assert` is
undefined behavior. It is possible that `assert` always causes `zig test` to
pass thus possibly leading to incorrect test code outcomes. The goal is to
prevent incorrect code from passing test cases.
Closes #5836
Diffstat (limited to 'src')
0 files changed, 0 insertions, 0 deletions
