authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2025-08-28 12:14:16 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2025-08-28 12:14:16 -07:00
loged2d27add43ab96584365e7ae40b5bf28ff9e07b
tree5ded4b45306f64a594e9ef558d1c4f40c0c5fdd1
parent23ed9b857ae78b1fcc021657b74fb206f006cd32

add build.zig and test


2 files changed, 31 insertions(+), 0 deletions(-)

build.zig created+25
...@@ -0,0 +1,25 @@
1const std = @import("std");
2
3pub fn build(b: *std.Build) void {
4 const target = b.standardTargetOptions(.{});
5 const mode = b.option(std.builtin.Mode, "mode", "") orelse .Debug;
6 const disable_llvm = b.option(bool, "disable_llvm", "use the non-llvm zig codegen") orelse false;
7
8 const mod = b.addModule("cookies", .{ .root_source_file = b.path("cookies.zig") });
9
10 const tests = b.addTest(.{
11 .root_source_file = b.path("test.zig"),
12 .target = target,
13 .optimize = mode,
14 });
15 tests.root_module.addImport("cookies", mod);
16 tests.root_module.link_libc = true;
17 tests.use_llvm = !disable_llvm;
18 tests.use_lld = !disable_llvm;
19
20 const test_step = b.step("test", "Run all library tests");
21 const tests_run = b.addRunArtifact(tests);
22 tests_run.setCwd(b.path("."));
23 tests_run.has_side_effects = true;
24 test_step.dependOn(&tests_run.step);
25}
test.zig created+6
...@@ -0,0 +1,6 @@
1const std = @import("std");
2const cookies = @import("cookies");
3
4test {
5 std.testing.refAllDecls(cookies);
6}