From 3fbf99ea5f22ecede384af4d1e13e175e3c493f1 Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Thu, 6 Feb 2025 04:37:05 -0800 Subject: [PATCH] add tests --- build.zig | 13 +++++++++++-- licenses.txt | 4 +--- test.zig | 7 +++++++ 3 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 test.zig diff --git a/build.zig b/build.zig index 24198d2354191010930f7b4f3fbb77dbe9cd3cc1..179f830d1d2aa455a8d21d8be979ed6651c861a5 100644 --- a/build.zig +++ b/build.zig @@ -23,6 +23,15 @@ pub fn build(b: *std.Build) void { const run_step = b.step("run", "Run the app"); run_step.dependOn(&run_cmd.step); - const test_step = b.step("test", "dummy test step to pass CI checks"); - _ = test_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); } diff --git a/licenses.txt b/licenses.txt index e20b5f2e90e8deb0efc12fae523e94558549a79d..9ae3746b4a66ae212bea5bd26d3d68aa52f27a1f 100644 --- a/licenses.txt +++ b/licenses.txt @@ -7,10 +7,8 @@ MIT: - git https://github.com/nektro/zig-extras - git https://github.com/nektro/zig-tracer - git https://github.com/truemedian/hzzp +- git https://github.com/kivikakk/htmlentities.zig MPL-2.0: = https://spdx.org/licenses/MPL-2.0 - git https://github.com/nektro/zig-pek - -Unspecified: -- git https://github.com/kivikakk/htmlentities.zig diff --git a/test.zig b/test.zig new file mode 100644 index 0000000000000000000000000000000000000000..1fa8d9433083b22b6f6589f8d0b9926262558e8e --- /dev/null +++ b/test.zig @@ -0,0 +1,7 @@ +const std = @import("std"); +const oauth2 = @import("oauth2"); + +// TODO: how do we make this better? +test { + std.testing.refAllDeclsRecursive(oauth2); +} -- 2.54.0