| author | |
| committer | |
| log | e892ee17e680d12292b971b553b36067ed3bbd74 |
| tree | ea6192e3cc8bf630298f4b26d449899e27151ce7 |
| parent | 0da027f07819657b6a93da6658e734eb1bdfe74f |
10 files changed, 17 insertions(+), 15 deletions(-)
lib/std/build.zig+1-1| ... | ... | @@ -2702,5 +2702,5 @@ test "" { |
| 2702 | 2702 | // The only purpose of this test is to get all these untested functions |
| 2703 | 2703 | // to be referenced to avoid regression so it is okay to skip some targets. |
| 2704 | 2704 | if (comptime std.Target.current.cpu.arch.ptrBitWidth() == 64) |
| 2705 | std.meta.refAllDecls(@This()); | |
| 2705 | std.testing.refAllDecls(@This()); | |
| 2706 | 2706 | } |
lib/std/build/emit_raw.zig+1-1| ... | ... | @@ -224,5 +224,5 @@ pub const InstallRawStep = struct { |
| 224 | 224 | }; |
| 225 | 225 | |
| 226 | 226 | test "" { |
| 227 | std.meta.refAllDecls(InstallRawStep); | |
| 227 | std.testing.refAllDecls(InstallRawStep); | |
| 228 | 228 | } |
lib/std/crypto.zig+1-1| ... | ... | @@ -110,7 +110,7 @@ test "crypto" { |
| 110 | 110 | inline for (std.meta.declarations(@This())) |decl| { |
| 111 | 111 | switch (decl.data) { |
| 112 | 112 | .Type => |t| { |
| 113 | std.meta.refAllDecls(t); | |
| 113 | std.testing.refAllDecls(t); | |
| 114 | 114 | }, |
| 115 | 115 | .Var => |v| { |
| 116 | 116 | _ = v; |
lib/std/math.zig+1-1| ... | ... | @@ -194,7 +194,7 @@ pub const Complex = complex.Complex; |
| 194 | 194 | pub const big = @import("math/big.zig"); |
| 195 | 195 | |
| 196 | 196 | test "" { |
| 197 | std.meta.refAllDecls(@This()); | |
| 197 | std.testing.refAllDecls(@This()); | |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | pub fn floatMantissaBits(comptime T: type) comptime_int { |
lib/std/meta.zig+1-7| ... | ... | @@ -655,13 +655,7 @@ pub fn fieldIndex(comptime T: type, comptime name: []const u8) ?comptime_int { |
| 655 | 655 | return null; |
| 656 | 656 | } |
| 657 | 657 | |
| 658 | /// Given a type, reference all the declarations inside, so that the semantic analyzer sees them. | |
| 659 | pub fn refAllDecls(comptime T: type) void { | |
| 660 | if (!builtin.is_test) return; | |
| 661 | inline for (declarations(T)) |decl| { | |
| 662 | _ = decl; | |
| 663 | } | |
| 664 | } | |
| 658 | pub const refAllDecls = @compileError("refAllDecls has been moved from std.meta to std.testing"); | |
| 665 | 659 | |
| 666 | 660 | /// Returns a slice of pointers to public declarations of a namespace. |
| 667 | 661 | pub fn declList(comptime Namespace: type, comptime Decl: type) []const *const Decl { |
lib/std/rand.zig+1-1| ... | ... | @@ -1140,5 +1140,5 @@ fn testRangeBias(r: *Random, start: i8, end: i8, biased: bool) void { |
| 1140 | 1140 | } |
| 1141 | 1141 | |
| 1142 | 1142 | test "" { |
| 1143 | std.meta.refAllDecls(@This()); | |
| 1143 | std.testing.refAllDecls(@This()); | |
| 1144 | 1144 | } |
lib/std/std.zig+1-1| ... | ... | @@ -92,5 +92,5 @@ comptime { |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | test "" { |
| 95 | meta.refAllDecls(@This()); | |
| 95 | testing.refAllDecls(@This()); | |
| 96 | 96 | } |
lib/std/target.zig+1-1| ... | ... | @@ -1516,5 +1516,5 @@ pub const Target = struct { |
| 1516 | 1516 | }; |
| 1517 | 1517 | |
| 1518 | 1518 | test "" { |
| 1519 | std.meta.refAllDecls(Target.Cpu.Arch); | |
| 1519 | std.testing.refAllDecls(Target.Cpu.Arch); | |
| 1520 | 1520 | } |
lib/std/testing.zig+8| ... | ... | @@ -389,3 +389,11 @@ fn printLine(line: []const u8) void { |
| 389 | 389 | test "" { |
| 390 | 390 | expectEqualStrings("foo", "foo"); |
| 391 | 391 | } |
| 392 | ||
| 393 | /// Given a type, reference all the declarations inside, so that the semantic analyzer sees them. | |
| 394 | pub fn refAllDecls(comptime T: type) void { | |
| 395 | if (!@import("builtin").is_test) return; | |
| 396 | inline for (std.meta.declarations(T)) |decl| { | |
| 397 | _ = decl; | |
| 398 | } | |
| 399 | } |
lib/std/zig.zig+1-1| ... | ... | @@ -255,5 +255,5 @@ test "parseCharLiteral" { |
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | test "" { |
| 258 | @import("std").meta.refAllDecls(@This()); | |
| 258 | @import("std").testing.refAllDecls(@This()); | |
| 259 | 259 | } |