From 2a1b48fe86ce1bd1e247e882d0677024876baeda Mon Sep 17 00:00:00 2001 From: Luna Date: Mon, 12 Apr 2021 23:19:06 -0300 Subject: [PATCH] add 'zig build test' command --- build.zig | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/build.zig b/build.zig index dafaf08..c686472 100644 --- a/build.zig +++ b/build.zig @@ -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); }