enum Name [src]
Fields
@"comptime" = std.math.maxInt(u32)
@"usingnamespace" = std.math.maxInt(u32) - 1
unnamed_test = std.math.maxInt(u32) - 2
_Other values are NullTerminatedString values, i.e. index into
string_bytes. If the byte referenced is 0, the decl is a named
test, and the actual name begins at the following byte.
Members
- isNamedTest (Function)
- toString (Function)
Source
pub const Name = enum(u32) {
@"comptime" = std.math.maxInt(u32),
@"usingnamespace" = std.math.maxInt(u32) - 1,
unnamed_test = std.math.maxInt(u32) - 2,
/// Other values are `NullTerminatedString` values, i.e. index into
/// `string_bytes`. If the byte referenced is 0, the decl is a named
/// test, and the actual name begins at the following byte.
_,
pub fn isNamedTest(name: Name, zir: Zir) bool {
return switch (name) {
.@"comptime", .@"usingnamespace", .unnamed_test => false,
_ => zir.string_bytes[@intFromEnum(name)] == 0,
};
}
pub fn toString(name: Name, zir: Zir) ?NullTerminatedString {
switch (name) {
.@"comptime", .@"usingnamespace", .unnamed_test => return null,
_ => {},
}
const idx: u32 = @intFromEnum(name);
if (zir.string_bytes[idx] == 0) {
// Named test
return @enumFromInt(idx + 1);
}
return @enumFromInt(idx);
}
}