aboutsummaryrefslogtreecommitdiff
path: root/examples/test-suite/build.zig
blob: 3b723e166462360256c76b769b093936450cc563 (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
const std = @import("std");

pub fn build(b: *std.Build) void {
    const target = b.standardTargetOptions(.{});
    const optimize = b.standardOptimizeOption(.{});

    const math_mod = b.addModule("math", .{
        .root_source_file = b.path("src/math.zig"),
        .target = target,
    });

    const strings_mod = b.addModule("strings", .{
        .root_source_file = b.path("src/strings.zig"),
        .target = target,
    });

    const math_tests = b.addTest(.{
        .root_module = b.createModule(.{
            .root_source_file = b.path("src/math.zig"),
            .target = target,
            .optimize = optimize,
        }),
    });
    const strings_tests = b.addTest(.{
        .root_module = b.createModule(.{
            .root_source_file = b.path("src/strings.zig"),
            .target = target,
            .optimize = optimize,
        }),
    });

    _ = math_mod;
    _ = strings_mod;

    const run_math = b.addRunArtifact(math_tests);
    const run_strings = b.addRunArtifact(strings_tests);

    const test_step = b.step("test", "Run all tests");
    test_step.dependOn(&run_math.step);
    test_step.dependOn(&run_strings.step);
}