From 8591731f2b938b2b55b05181d5ec0e27f79c86fa Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Thu, 24 Oct 2019 00:30:17 -0400 Subject: [PATCH] refAllDecls in a test block to limit when it gets run --- lib/std/math.zig | 2 +- lib/std/os.zig | 23 ++++++++++++----------- lib/std/std.zig | 2 +- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/lib/std/math.zig b/lib/std/math.zig index cb9589e95d..9b56d0b8ce 100644 --- a/lib/std/math.zig +++ b/lib/std/math.zig @@ -202,7 +202,7 @@ pub const Complex = complex.Complex; pub const big = @import("math/big.zig"); -comptime { +test "" { std.meta.refAllDecls(@This()); } diff --git a/lib/std/os.zig b/lib/std/os.zig index 19ca282979..4a2c0b971e 100644 --- a/lib/std/os.zig +++ b/lib/std/os.zig @@ -34,18 +34,19 @@ pub const zen = @import("os/zen.zig"); comptime { assert(@import("std") == std); // std lib tests require --override-lib-dir - if (builtin.is_test) { - _ = darwin; - _ = freebsd; - _ = linux; - _ = netbsd; - _ = uefi; - _ = wasi; - _ = windows; - _ = zen; +} - _ = @import("os/test.zig"); - } +test "" { + _ = darwin; + _ = freebsd; + _ = linux; + _ = netbsd; + _ = uefi; + _ = wasi; + _ = windows; + _ = zen; + + _ = @import("os/test.zig"); } /// When linking libc, this is the C API. Otherwise, it is the OS-specific system interface. diff --git a/lib/std/std.zig b/lib/std/std.zig index a7cce4fd6f..ea6257009f 100644 --- a/lib/std/std.zig +++ b/lib/std/std.zig @@ -65,6 +65,6 @@ pub const unicode = @import("unicode.zig"); pub const valgrind = @import("valgrind.zig"); pub const zig = @import("zig.zig"); -comptime { +test "" { meta.refAllDecls(@This()); }