Commit 8591731f2b

Andrew Kelley <andrew@ziglang.org>
2019-10-24 06:30:17
refAllDecls in a test block to limit when it gets run
1 parent 17eb24a
Changed files (3)
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());
 }
 
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.
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());
 }