wip: started a refactoring
This commit is contained in:
parent
75ccf913ac
commit
4970b1b1f6
6 changed files with 524 additions and 169 deletions
34
build.zig
34
build.zig
|
|
@ -130,14 +130,11 @@ pub fn build(b: *std.Build) void {
|
|||
// Creates an executable that will run `test` blocks from the provided module.
|
||||
// Here `mod` needs to define a target, which is why earlier we made sure to
|
||||
// set the releative field.
|
||||
const mod_tests = b.addTest(.{
|
||||
const run_mod_tests = b.addRunArtifact(b.addTest(.{
|
||||
.root_module = mod,
|
||||
});
|
||||
}));
|
||||
|
||||
// A run step that will run the test executable.
|
||||
const run_mod_tests = b.addRunArtifact(mod_tests);
|
||||
|
||||
const bot_tests = b.addTest(.{
|
||||
const run_bot_tests = b.addRunArtifact(b.addTest(.{
|
||||
.root_module = b.addModule("bot", .{
|
||||
.target = target,
|
||||
.root_source_file = b.path("src/bot.zig"),
|
||||
|
|
@ -148,19 +145,28 @@ pub fn build(b: *std.Build) void {
|
|||
},
|
||||
},
|
||||
}),
|
||||
});
|
||||
}));
|
||||
|
||||
const run_bot_tests = b.addRunArtifact(bot_tests);
|
||||
const run_parser_tests = b.addRunArtifact(b.addTest(.{
|
||||
.root_module = b.addModule("parser", .{
|
||||
.target = target,
|
||||
.root_source_file = b.path("src/parser.zig"),
|
||||
}),
|
||||
}));
|
||||
|
||||
const run_buffer_tests = b.addRunArtifact(b.addTest(.{
|
||||
.root_module = b.addModule("buffer", .{
|
||||
.target = target,
|
||||
.root_source_file = b.path("src/buffer.zig"),
|
||||
}),
|
||||
}));
|
||||
|
||||
// Creates an executable that will run `test` blocks from the executable's
|
||||
// root module. Note that test executables only test one module at a time,
|
||||
// hence why we have to create two separate ones.
|
||||
const exe_tests = b.addTest(.{
|
||||
const run_exe_tests = b.addRunArtifact(b.addTest(.{
|
||||
.root_module = exe.root_module,
|
||||
});
|
||||
|
||||
// A run step that will run the second test executable.
|
||||
const run_exe_tests = b.addRunArtifact(exe_tests);
|
||||
}));
|
||||
|
||||
// A top level step for running all tests. dependOn can be called multiple
|
||||
// times and since the two run steps do not depend on one another, this will
|
||||
|
|
@ -168,7 +174,9 @@ pub fn build(b: *std.Build) void {
|
|||
const test_step = b.step("test", "Run tests");
|
||||
test_step.dependOn(&run_mod_tests.step);
|
||||
test_step.dependOn(&run_exe_tests.step);
|
||||
test_step.dependOn(&run_parser_tests.step);
|
||||
test_step.dependOn(&run_bot_tests.step);
|
||||
test_step.dependOn(&run_buffer_tests.step);
|
||||
|
||||
// Just like flags, top level steps are also listed in the `--help` menu.
|
||||
//
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue