From d794a57b4e72126da678ebe86504700d996e9fe0 Mon Sep 17 00:00:00 2001 From: Rekai Musuka Date: Mon, 1 May 2023 23:59:51 -0500 Subject: [PATCH] chore: update build.zig --- build.zig | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/build.zig b/build.zig index 9345628..560b1c8 100644 --- a/build.zig +++ b/build.zig @@ -27,18 +27,21 @@ pub fn build(b: *std.Build) void { // This declares intent for the library to be installed into the standard // location when the user invokes the "install" step (the default step when // running `zig build`). - lib.install(); + b.installArtifact(lib); - // Creates a step for unit testing. + // Creates a step for unit testing. This only builds the test executable + // but does not run it. const main_tests = b.addTest(.{ - .root_source_file = .{ .path = "src/main.zig" }, + .root_source_file = .{ .path = "src/lib.zig" }, .target = target, .optimize = optimize, }); + const run_main_tests = b.addRunArtifact(main_tests); + // This creates a build step. It will be visible in the `zig build --help` menu, // and can be selected like this: `zig build test` // This will evaluate the `test` step rather than the default, which is "install". const test_step = b.step("test", "Run library tests"); - test_step.dependOn(&main_tests.step); + test_step.dependOn(&run_main_tests.step); }