build test: install unit tests binary

I've gotten tired of trying to find this in the cache dir, since the
build system does not rerun it once it is cached. Also sometimes the
build runner does weird things to the output.
This commit is contained in:
torque 2023-08-27 18:05:33 -07:00
parent 4cf5049882
commit d3d5849f55
Signed by: torque
SSH Key Fingerprint: SHA256:nCrXefBNo6EbjNSQhv0nXmEg/VuNq3sMF5b8zETw3Tk

View File

@ -19,6 +19,7 @@ pub fn build(b: *std.Build) void {
}); });
const tests = b.addTest(.{ const tests = b.addTest(.{
.name = "nats-zig-unit-tests",
.root_source_file = .{ .path = "tests/main.zig" }, .root_source_file = .{ .path = "tests/main.zig" },
.target = target, .target = target,
.optimize = optimize, .optimize = optimize,
@ -29,6 +30,7 @@ pub fn build(b: *std.Build) void {
const run_main_tests = b.addRunArtifact(tests); const run_main_tests = b.addRunArtifact(tests);
const test_step = b.step("test", "Run tests"); const test_step = b.step("test", "Run tests");
test_step.dependOn(&b.addInstallArtifact(tests, .{}).step);
test_step.dependOn(&run_main_tests.step); test_step.dependOn(&run_main_tests.step);
add_examples(b, .{ add_examples(b, .{