diff --git a/build.zig b/build.zig index 5f1250f230163c565f5e7e340cc8fdd1c152439f..913075b1750ec53615b5ac3fb20faa86aeecbc69 100644 --- a/build.zig +++ b/build.zig @@ -42,4 +42,17 @@ pub fn build(b: *std.Build) void { const run_step2 = b.step("gen", "generate the list"); run_step2.dependOn(&run_cmd2.step); + + const tests = b.addTest(.{ + .root_source_file = b.path("test.zig"), + .target = target, + .optimize = mode, + }); + deps.addAllTo(tests); + + const test_step = b.step("test", "Run all library tests"); + const tests_run = b.addRunArtifact(tests); + tests_run.has_side_effects = true; + test_step.dependOn(&tests_run.step); + test_step.dependOn(&exe2.step); } diff --git a/test.zig b/test.zig new file mode 100644 index 0000000000000000000000000000000000000000..0f9bcb8339b69e538f143f6d3e64c7ab5e89590d --- /dev/null +++ b/test.zig @@ -0,0 +1,12 @@ +const std = @import("std"); +const licenses = @import("licenses"); + +test { + _ = &licenses.spdx; + _ = &licenses.osi; + _ = &licenses.blueoak.model; + _ = &licenses.blueoak.gold; + _ = &licenses.blueoak.silver; + _ = &licenses.blueoak.bronze; + _ = &licenses.blueoak.lead; +} diff --git a/zig.mod b/zig.mod index ed103de8ecea48b397164d33730bdb4fb43c1df4..6ad3da4f0a97a6fe5e10b88c5699dd011a9058d8 100644 --- a/zig.mod +++ b/zig.mod @@ -2,6 +2,5 @@ id: 0npcrzfdlrvkf44mzjo8bduj9gmqyefo0j3rstt6b0pm2r6r name: licenses main: src/lib.zig license: MIT - -dev_dependencies: +root_dependencies: - src: git https://github.com/nektro/zig-json