Add test build with just command
This commit is contained in:
parent
485c168b39
commit
f406495e22
2 changed files with 25 additions and 0 deletions
22
build.zig
22
build.zig
|
|
@ -31,4 +31,26 @@ pub fn build(b: *std.Build) void {
|
||||||
|
|
||||||
const run_step = b.step("run", "run the game");
|
const run_step = b.step("run", "run the game");
|
||||||
run_step.dependOn(&run_cmd.step);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
3
justfile
3
justfile
|
|
@ -34,3 +34,6 @@ clean:
|
||||||
# check for compile errors without building
|
# check for compile errors without building
|
||||||
check:
|
check:
|
||||||
zig build --summary all 2>&1 | head -50
|
zig build --summary all 2>&1 | head -50
|
||||||
|
|
||||||
|
test:
|
||||||
|
zig build test
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue