Generating Tests at Comptime

As an update I found a way to do it by digging through the standard library:

comptime {
    const files = .{"hay", "hey", "hooi", "needle"};
    for(files) |file| {
        _ = struct {
            test {
                try std.testing.expect(std.mem.eql(u8, file, "needle"));
            }
        };
    }
}

This serves my purpose well :slight_smile: ! That being said if someone knows how I can give these tests names that would be even better.

2 Likes