From c2db077574be841da586fa62d67619c901dd535d Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Fri, 8 Feb 2019 18:18:47 -0500 Subject: std.debug.assert: remove special case for test builds Previously, std.debug.assert would `@panic` in test builds, if the assertion failed. Now, it's always `unreachable`. This makes release mode test builds more accurately test the actual code that will be run. However this requires tests to call `std.testing.expect` rather than `std.debug.assert` to make sure output is correct. Here is the explanation of when to use either one, copied from the assert doc comments: Inside a test block, it is best to use the `std.testing` module rather than assert, because assert may not detect a test failure in ReleaseFast and ReleaseSafe mode. Outside of a test block, assert is the correct function to use. closes #1304 --- std/index.zig | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'std/index.zig') diff --git a/std/index.zig b/std/index.zig index 2a63244004..9d9b7ee8d6 100644 --- a/std/index.zig +++ b/std/index.zig @@ -31,6 +31,7 @@ pub const hash_map = @import("hash_map.zig"); pub const heap = @import("heap.zig"); pub const io = @import("io.zig"); pub const json = @import("json.zig"); +pub const lazyInit = @import("lazy_init.zig").lazyInit; pub const macho = @import("macho.zig"); pub const math = @import("math/index.zig"); pub const mem = @import("mem.zig"); @@ -41,11 +42,10 @@ pub const pdb = @import("pdb.zig"); pub const rand = @import("rand/index.zig"); pub const rb = @import("rb.zig"); pub const sort = @import("sort.zig"); +pub const testing = @import("testing.zig"); pub const unicode = @import("unicode.zig"); pub const zig = @import("zig/index.zig"); -pub const lazyInit = @import("lazy_init.zig").lazyInit; - test "std" { // run tests from these _ = @import("array_list.zig"); @@ -60,7 +60,6 @@ test "std" { _ = @import("segmented_list.zig"); _ = @import("spinlock.zig"); - _ = @import("dynamic_library.zig"); _ = @import("base64.zig"); _ = @import("build.zig"); _ = @import("c/index.zig"); @@ -69,24 +68,26 @@ test "std" { _ = @import("cstr.zig"); _ = @import("debug/index.zig"); _ = @import("dwarf.zig"); + _ = @import("dynamic_library.zig"); _ = @import("elf.zig"); _ = @import("empty.zig"); _ = @import("event.zig"); _ = @import("fmt/index.zig"); _ = @import("hash/index.zig"); + _ = @import("heap.zig"); _ = @import("io.zig"); _ = @import("json.zig"); + _ = @import("lazy_init.zig"); _ = @import("macho.zig"); _ = @import("math/index.zig"); - _ = @import("meta/index.zig"); _ = @import("mem.zig"); + _ = @import("meta/index.zig"); _ = @import("net.zig"); - _ = @import("heap.zig"); _ = @import("os/index.zig"); - _ = @import("rand/index.zig"); _ = @import("pdb.zig"); + _ = @import("rand/index.zig"); _ = @import("sort.zig"); + _ = @import("testing.zig"); _ = @import("unicode.zig"); _ = @import("zig/index.zig"); - _ = @import("lazy_init.zig"); } -- cgit v1.2.3