diff options
| author | Tadeo Kondrak <me@tadeo.ca> | 2020-09-28 07:29:53 -0600 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-10-15 20:34:22 -0400 |
| commit | e892ee17e680d12292b971b553b36067ed3bbd74 (patch) | |
| tree | ea6192e3cc8bf630298f4b26d449899e27151ce7 /lib/std/testing.zig | |
| parent | 0da027f07819657b6a93da6658e734eb1bdfe74f (diff) | |
| download | zig-e892ee17e680d12292b971b553b36067ed3bbd74.tar.gz zig-e892ee17e680d12292b971b553b36067ed3bbd74.zip | |
std: move std.meta.refAllDecls to std.testing
Diffstat (limited to 'lib/std/testing.zig')
| -rw-r--r-- | lib/std/testing.zig | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/std/testing.zig b/lib/std/testing.zig index ccbd1d6324..4b388adb67 100644 --- a/lib/std/testing.zig +++ b/lib/std/testing.zig @@ -389,3 +389,11 @@ fn printLine(line: []const u8) void { test "" { expectEqualStrings("foo", "foo"); } + +/// Given a type, reference all the declarations inside, so that the semantic analyzer sees them. +pub fn refAllDecls(comptime T: type) void { + if (!@import("builtin").is_test) return; + inline for (std.meta.declarations(T)) |decl| { + _ = decl; + } +} |
