| 1 | const std = @import("std"); |
| 2 | |
| 3 | pub fn build(b: *std.Build) void { |
| 4 | const test_mod = b.createModule(.{ |
| 5 | .root_source_file = b.path("src/main.zig"), |
| 6 | .target = b.graph.host, |
| 7 | }); |
| 8 | const module1 = b.createModule(.{ .root_source_file = b.path("module1/main.zig") }); |
| 9 | const module2 = b.createModule(.{ .root_source_file = b.path("module2/main.zig") }); |
| 10 | |
| 11 | module2.addImport("module1", module1); |
| 12 | test_mod.addImport("module2", module2); |
| 13 | |
| 14 | const t = b.addTest(.{ |
| 15 | .root_module = test_mod, |
| 16 | .test_runner = .{ |
| 17 | .path = b.path("test_runner/main.zig"), |
| 18 | .mode = .simple, |
| 19 | }, |
| 20 | }); |
| 21 | |
| 22 | const test_step = b.step("test", "Run unit tests"); |
| 23 | test_step.dependOn(&b.addRunArtifact(t).step); |
| 24 | b.default_step = test_step; |
| 25 | } |