mirror of
https://github.com/ziglang/zig.git
synced 2024-11-14 16:13:24 +00:00
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
This commit is contained in:
parent
1e13e8e817
commit
ddd39b994b