ReviewOS

also looking at this

zig-utils/zig-test-framework

test: make CI exercise maintained integrations

#18
Merged glennmichael123 wants to merge codex/issue-3-test-coverage into main
16 files +390 -139
build.zigmodified+87-2
Changes to build.zig
@@ -19,6 +19,9 @@ pub fn build(b: *std.Build) void {
1919 .target = target,
2020 .optimize = optimize,
2121 .link_libc = true,
22 .imports = &.{
23 .{ .name = "zig_test_framework", .module = lib_module },
24 },
2225 }),
2326 });
2427
@@ -46,6 +49,9 @@ pub fn build(b: *std.Build) void {
4649 .target = target,
4750 .optimize = optimize,
4851 .link_libc = true,
52 .imports = &.{
53 .{ .name = "zig_test_framework", .module = lib_module },
54 },
4955 }),
5056 });
5157 const run_test_runner_tests = b.addRunArtifact(test_runner_tests);
@@ -57,6 +63,9 @@ pub fn build(b: *std.Build) void {
5763 .target = target,
5864 .optimize = optimize,
5965 .link_libc = true,
66 .imports = &.{
67 .{ .name = "zig_test_framework", .module = lib_module },
68 },
6069 }),
6170 });
6271 const run_assertions_tests = b.addRunArtifact(assertions_tests);
@@ -68,6 +77,9 @@ pub fn build(b: *std.Build) void {
6877 .target = target,
6978 .optimize = optimize,
7079 .link_libc = true,
80 .imports = &.{
81 .{ .name = "zig_test_framework", .module = lib_module },
82 },
7183 }),
7284 });
7385 const run_suite_tests = b.addRunArtifact(suite_tests);
@@ -79,6 +91,9 @@ pub fn build(b: *std.Build) void {
7991 .target = target,
8092 .optimize = optimize,
8193 .link_libc = true,
94 .imports = &.{
95 .{ .name = "zig_test_framework", .module = lib_module },
96 },
8297 }),
8398 });
8499 const run_matchers_tests = b.addRunArtifact(matchers_tests);
@@ -108,6 +123,9 @@ pub fn build(b: *std.Build) void {
108123 .target = target,
109124 .optimize = optimize,
110125 .link_libc = true,
126 .imports = &.{
127 .{ .name = "zig_test_framework", .module = lib_module },
128 },
111129 }),
112130 });
113131 const run_reporter_tests = b.addRunArtifact(reporter_tests);
@@ -119,6 +137,9 @@ pub fn build(b: *std.Build) void {
119137 .target = target,
120138 .optimize = optimize,
121139 .link_libc = true,
140 .imports = &.{
141 .{ .name = "zig_test_framework", .module = lib_module },
142 },
122143 }),
123144 });
124145 const run_cli_tests = b.addRunArtifact(cli_tests);
@@ -144,6 +165,9 @@ pub fn build(b: *std.Build) void {
144165 .target = target,
145166 .optimize = optimize,
146167 .link_libc = true,
168 .imports = &.{
169 .{ .name = "zig_test_framework", .module = lib_module },
170 },
147171 }),
148172 });
149173 const run_mock_tests = b.addRunArtifact(mock_tests);
@@ -209,11 +233,14 @@ pub fn build(b: *std.Build) void {
209233 test_step.dependOn(&run_assertions_tests.step);
210234 test_step.dependOn(&run_suite_tests.step);
211235 test_step.dependOn(&run_matchers_tests.step);
212 // Note: hooks_test is an executable, run with 'zig build test-hooks'
236 test_step.dependOn(&run_hooks_tests.step);
213237 test_step.dependOn(&run_reporter_tests.step);
214238 test_step.dependOn(&run_cli_tests.step);
215239 test_step.dependOn(&run_filter_tests.step);
216240 test_step.dependOn(&run_mock_tests.step);
241 test_step.dependOn(&run_comprehensive_mock_tests.step);
242 test_step.dependOn(&run_snapshot_usage_tests.step);
243 test_step.dependOn(&run_time_tests.step);
217244
218245 // Examples
219246 const basic_example = b.addExecutable(.{
@@ -245,7 +272,65 @@ pub fn build(b: *std.Build) void {
245272 const run_basic_example = b.addRunArtifact(basic_example);
246273 const run_advanced_example = b.addRunArtifact(advanced_example);
247274
248 const examples_step = b.step("examples", "Run all examples");
275 // These showcase intentionally slow, interactive, or failure-oriented
276 // scenarios, so keep them compile-only while still checking every example.
277 const async_examples = b.addExecutable(.{
278 .name = "async_examples",
279 .root_module = b.createModule(.{
280 .root_source_file = b.path("examples/async_tests.zig"),
281 .target = target,
282 .optimize = optimize,
283 .link_libc = true,
284 .imports = &.{
285 .{ .name = "zig_test", .module = lib_module },
286 },
287 }),
288 });
289
290 const snapshot_examples = b.addExecutable(.{
291 .name = "snapshot_examples",
292 .root_module = b.createModule(.{
293 .root_source_file = b.path("examples/snapshot_examples.zig"),
294 .target = target,
295 .optimize = optimize,
296 .link_libc = true,
297 .imports = &.{
298 .{ .name = "zig_test", .module = lib_module },
299 },
300 }),
301 });
302
303 const progress_examples = b.addExecutable(.{
304 .name = "progress_examples",
305 .root_module = b.createModule(.{
306 .root_source_file = b.path("examples/progress_examples.zig"),
307 .target = target,
308 .optimize = optimize,
309 .link_libc = true,
310 .imports = &.{
311 .{ .name = "zig_test", .module = lib_module },
312 },
313 }),
314 });
315
316 const timeout_examples = b.addExecutable(.{
317 .name = "timeout_examples",
318 .root_module = b.createModule(.{
319 .root_source_file = b.path("examples/timeout_examples.zig"),
320 .target = target,
321 .optimize = optimize,
322 .link_libc = true,
323 .imports = &.{
324 .{ .name = "zig_test", .module = lib_module },
325 },
326 }),
327 });
328
329 const examples_step = b.step("examples", "Run core examples and compile all examples");
249330 examples_step.dependOn(&run_basic_example.step);
250331 examples_step.dependOn(&run_advanced_example.step);
332 examples_step.dependOn(&async_examples.step);
333 examples_step.dependOn(&snapshot_examples.step);
334 examples_step.dependOn(&progress_examples.step);
335 examples_step.dependOn(&timeout_examples.step);
251336}