Basic test implementation

This commit is contained in:
2026-04-29 11:33:50 +02:00
parent be06634232
commit d7c7320443
4 changed files with 28 additions and 10 deletions

View File

@@ -130,6 +130,20 @@ pub fn build(b: *std.Build) void {
run_cmd.addArgs(args);
}
const tests = b.addTest(.{
.root_module = b.createModule(.{
.root_source_file = b.path("src/test.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "raylib", .module = raylib },
},
}),
});
tests.root_module.linkLibrary(raylib_artifact);
const run_tests = b.addRunArtifact(tests);
// Creates an executable that will run `test` blocks from the provided module.
// Here `mod` needs to define a target, which is why earlier we made sure to
// set the releative field.
@@ -156,6 +170,7 @@ pub fn build(b: *std.Build) void {
const test_step = b.step("test", "Run tests");
// test_step.dependOn(&run_mod_tests.step);
test_step.dependOn(&run_exe_tests.step);
test_step.dependOn(&run_tests.step);
// Just like flags, top level steps are also listed in the `--help` menu.
//