add 'zig build test' command

This commit is contained in:
Luna 2021-04-12 23:19:06 -03:00
parent 96c6f8bc0c
commit 2a1b48fe86

View file

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