commit 8591731f2b938b2b55b05181d5ec0e27f79c86fa (tree)
parent 17eb24a7e4b2bc5740dc15996acc4736833cb2a0
Author: Andrew Kelley <andrew@ziglang.org>
Date: Thu, 24 Oct 2019 00:30:17 -0400
refAllDecls in a test block to limit when it gets run
Diffstat:
3 files changed, 15 insertions(+), 14 deletions(-)
diff --git 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
@@ -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
@@ -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());
}