Basic test implementation
This commit is contained in:
15
build.zig
15
build.zig
@@ -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.
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user