ReviewOS

also looking at this

zig-utils/zig-test-framework

fix: honor discovery-mode CLI options

#17
Merged glennmichael123 wants to merge codex/issue-2-discovery-cli into main
10 files +192 -24
src/coverage.zigmodified+12-0
Changes to src/coverage.zig
@@ -168,6 +168,16 @@ pub fn runTestWithCoverage(
168168 allocator: std.mem.Allocator,
169169 test_file_path: []const u8,
170170 options: CoverageOptions,
171) !bool {
172 return runTestWithCoverageArgs(allocator, test_file_path, &.{}, options);
173}
174
175/// Run a test file with coverage while forwarding Zig test arguments.
176pub fn runTestWithCoverageArgs(
177 allocator: std.mem.Allocator,
178 test_file_path: []const u8,
179 test_args: []const []const u8,
180 options: CoverageOptions,
171181) !bool {
172182 if (!options.enabled) {
173183 return error.CoverageNotEnabled;
@@ -189,6 +199,7 @@ pub fn runTestWithCoverage(
189199 try argv.append(allocator, "zig");
190200 try argv.append(allocator, "test");
191201 try argv.append(allocator, test_file_path);
202 try argv.appendSlice(allocator, test_args);
192203
193204 const term = try compat.spawnAndWait(allocator, argv.items, .Inherit, .Inherit);
194205 return switch (term) {
@@ -210,6 +221,7 @@ pub fn runTestWithCoverage(
210221 try argv.append(allocator, "zig");
211222 try argv.append(allocator, "test");
212223 try argv.append(allocator, test_file_path);
224 try argv.appendSlice(allocator, test_args);
213225
214226 switch (options.tool) {
215227 .kcov => {