Add test build with just command

This commit is contained in:
Jared Miller 2025-12-04 18:28:51 -05:00
parent 485c168b39
commit f406495e22
2 changed files with 25 additions and 0 deletions

View file

@ -31,4 +31,26 @@ pub fn build(b: *std.Build) void {
const run_step = b.step("run", "run the game");
run_step.dependOn(&run_cmd.step);
// test step (doesn't need raylib)
const test_step = b.step("test", "run unit tests");
const test_files = [_][]const u8{
"src/fixed.zig",
"src/trig.zig",
"src/terrain.zig",
"src/game.zig",
};
for (test_files) |file| {
const unit_test = b.addTest(.{
.root_module = b.createModule(.{
.root_source_file = b.path(file),
.target = target,
.optimize = optimize,
}),
});
const run_test = b.addRunArtifact(unit_test);
test_step.dependOn(&run_test.step);
}
}

View file

@ -34,3 +34,6 @@ clean:
# check for compile errors without building
check:
zig build --summary all 2>&1 | head -50
test:
zig build test