mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-04-27 19:09:47 +03:00
std.testing: delete refAllDeclsRecursive
suggested alternatives: - actual tests - explicitly list the decls - compile an example application that uses the API - stop worrying about dead code - refAllDecls (non recursive) in each file Don't fight the laziness, embrace it. closes #23608 closes #30813
This commit is contained in:
@@ -53,6 +53,5 @@ pub const HiiDatabase = @import("protocol/hii_database.zig").HiiDatabase;
|
||||
pub const HiiPopup = @import("protocol/hii_popup.zig").HiiPopup;
|
||||
|
||||
test {
|
||||
@setEvalBranchQuota(2000);
|
||||
@import("std").testing.refAllDeclsRecursive(@This());
|
||||
std.testing.refAllDecls(@This());
|
||||
}
|
||||
|
||||
@@ -305,5 +305,5 @@ pub const global_variable = Guid{
|
||||
};
|
||||
|
||||
test {
|
||||
std.testing.refAllDeclsRecursive(@This());
|
||||
std.testing.refAllDecls(@This());
|
||||
}
|
||||
|
||||
@@ -1200,21 +1200,6 @@ pub fn refAllDecls(comptime T: type) void {
|
||||
}
|
||||
}
|
||||
|
||||
/// Given a type, recursively references all the declarations inside, so that the semantic analyzer sees them.
|
||||
/// For deep types, you may use `@setEvalBranchQuota`.
|
||||
pub fn refAllDeclsRecursive(comptime T: type) void {
|
||||
if (!builtin.is_test) return;
|
||||
inline for (comptime std.meta.declarations(T)) |decl| {
|
||||
if (@TypeOf(@field(T, decl.name)) == type) {
|
||||
switch (@typeInfo(@field(T, decl.name))) {
|
||||
.@"struct", .@"enum", .@"union", .@"opaque" => refAllDeclsRecursive(@field(T, decl.name)),
|
||||
else => {},
|
||||
}
|
||||
}
|
||||
_ = &@field(T, decl.name);
|
||||
}
|
||||
}
|
||||
|
||||
pub const FuzzInputOptions = struct {
|
||||
corpus: []const []const u8 = &.{},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user