aboutsummaryrefslogtreecommitdiff
path: root/test/standalone/test_runner_module_imports/build.zig
blob: ae6530833187073e83e7d1ea6dae98919cc140f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
const std = @import("std");

pub fn build(b: *std.Build) void {
    const test_mod = b.createModule(.{
        .root_source_file = b.path("src/main.zig"),
        .target = b.graph.host,
    });
    const module1 = b.createModule(.{ .root_source_file = b.path("module1/main.zig") });
    const module2 = b.createModule(.{ .root_source_file = b.path("module2/main.zig") });

    module2.addImport("module1", module1);
    test_mod.addImport("module2", module2);

    const t = b.addTest(.{
        .root_module = test_mod,
        .test_runner = .{
            .path = b.path("test_runner/main.zig"),
            .mode = .simple,
        },
    });

    const test_step = b.step("test", "Run unit tests");
    test_step.dependOn(&b.addRunArtifact(t).step);
    b.default_step = test_step;
}