-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.zig
39 lines (31 loc) · 1.35 KB
/
build.zig
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
const std = @import("std");
pub fn build(b: *std.Build) void {
const myzql = b.addModule("myzql", .{
.root_source_file = b.path("./src/myzql.zig"),
});
// -Dtest-filter="..."
const test_filter = b.option([]const []const u8, "test-filter", "Filter for tests to run");
// zig build unit_test
const unit_tests = b.addTest(.{
.root_source_file = b.path("./src/myzql.zig"),
});
if (test_filter) |t| unit_tests.filters = t;
// zig build [install]
b.installArtifact(unit_tests);
// zig build -Dtest-filter="..." run_unit_test
const run_unit_tests = b.addRunArtifact(unit_tests);
const unit_test_step = b.step("unit_test", "Run unit tests");
unit_test_step.dependOn(&run_unit_tests.step);
// zig build -Dtest-filter="..." integration_test
const integration_tests = b.addTest(.{
.root_source_file = b.path("./integration_tests/main.zig"),
});
integration_tests.root_module.addImport("myzql", myzql);
if (test_filter) |t| integration_tests.filters = t;
// zig build [install]
b.installArtifact(integration_tests);
// zig build integration_test
const run_integration_tests = b.addRunArtifact(integration_tests);
const integration_test_step = b.step("integration_test", "Run integration tests");
integration_test_step.dependOn(&run_integration_tests.step);
}