From 7b266fde587ec56da79847b8fe3eb8e85080459d Mon Sep 17 00:00:00 2001 From: kayomn Date: Mon, 10 Jul 2023 23:44:27 +0100 Subject: [PATCH] Fix tests failing to trigger in CI --- build.zig | 20 +++++++++++++++----- source/test.zig | 3 +++ 2 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 source/test.zig diff --git a/build.zig b/build.zig index 2db09f4..4ff8fb2 100644 --- a/build.zig +++ b/build.zig @@ -18,17 +18,27 @@ pub fn build(b: *std.Build) void { }); b.installArtifact(create: { - const runner_exe = b.addExecutable(.{ + const compile_step = b.addExecutable(.{ .name = "runner", .root_source_file = .{ .path = "source/runner.zig" }, .target = target, .optimize = optimize, }); - runner_exe.addModule("ona", ona_module); - runner_exe.linkLibC(); - runner_exe.linkSystemLibrary("SDL2"); + compile_step.addModule("ona", ona_module); + compile_step.linkLibC(); + compile_step.linkSystemLibrary("SDL2"); - break: create runner_exe; + break: create compile_step; + }); + + b.step("test", "Run unit tests").dependOn(create: { + const tests = b.addTest(.{ + .root_source_file = .{.path = "source/test.zig"}, + .target = target, + .optimize = optimize, + }); + + break: create &tests.step; }); } diff --git a/source/test.zig b/source/test.zig new file mode 100644 index 0000000..f56b57f --- /dev/null +++ b/source/test.zig @@ -0,0 +1,3 @@ +const coral = @import("coral"); + +const ona = @import("ona");