add 'zig build test' command

This commit is contained in:
Luna 2021-04-12 23:19:06 -03:00
parent 96c6f8bc0c
commit 2a1b48fe86
1 changed files with 7 additions and 0 deletions

View File

@ -18,6 +18,10 @@ pub fn build(b: *std.build.Builder) void {
deps.addAllTo(exe);
exe.install();
const exe_test = b.addTest("src/main.zig");
exe_test.setTarget(target);
deps.addAllTo(exe_test);
const run_cmd = exe.run();
run_cmd.step.dependOn(b.getInstallStep());
if (b.args) |args| {
@ -26,4 +30,7 @@ pub fn build(b: *std.build.Builder) void {
const run_step = b.step("run", "Run the app");
run_step.dependOn(&run_cmd.step);
const test_step = b.step("test", "Test stuff");
test_step.dependOn(&exe_test.step);
}