zig/test/standalone/test_runner_module_imports/build.zig
Andrew Kelley 7fb5a0b18b introduce std.Build.path; deprecate LazyPath.relative
This adds the *std.Build owner to LazyPath so that lazy paths returned
from a dependency can be used in the application without friction or
footguns.

closes #19313
2024-04-10 15:02:20 -07:00

21 lines
671 B
Zig

const std = @import("std");
pub fn build(b: *std.Build) void {
const t = b.addTest(.{
.root_source_file = .{ .path = "src/main.zig" },
.test_runner = b.path("test_runner/main.zig"),
});
const module1 = b.createModule(.{ .root_source_file = .{ .path = "module1/main.zig" } });
const module2 = b.createModule(.{
.root_source_file = .{ .path = "module2/main.zig" },
.imports = &.{.{ .name = "module1", .module = module1 }},
});
t.root_module.addImport("module2", module2);
const test_step = b.step("test", "Run unit tests");
test_step.dependOn(&b.addRunArtifact(t).step);
b.default_step = test_step;
}