Add a basic build.zig and main.zig to run tests from multiple modules

This commit is contained in:
Alex Selimov 2026-07-29 10:59:08 -04:00
parent a1009e4d3e
commit 738349ffe7
3 changed files with 26 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
.zig-cache

18
build.zig Normal file
View file

@ -0,0 +1,18 @@
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const test_step = b.step("test", "Run unit tests");
const unit_tests = b.addTest(.{
.root_module = b.createModule(.{
.root_source_file = b.path("./main.zig"),
.target = target,
.optimize = optimize,
}),
});
const run_unit_tests = b.addRunArtifact(unit_tests);
test_step.dependOn(&run_unit_tests.step);
}

7
main.zig Normal file
View file

@ -0,0 +1,7 @@
const std = @import("std");
pub fn main() !void {}
test "main" {
_ = @import("./vec3/src/vec3.zig");
}