also looking at this
fix: honor discovery-mode CLI options
#17
10 files
+192
-24
| @@ -168,6 +168,16 @@ pub fn runTestWithCoverage( | ||
| 168 | 168 | allocator: std.mem.Allocator, |
| 169 | 169 | test_file_path: []const u8, |
| 170 | 170 | 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. | |
| 176 | pub fn runTestWithCoverageArgs( | |
| 177 | allocator: std.mem.Allocator, | |
| 178 | test_file_path: []const u8, | |
| 179 | test_args: []const []const u8, | |
| 180 | options: CoverageOptions, | |
| 171 | 181 | ) !bool { |
| 172 | 182 | if (!options.enabled) { |
| 173 | 183 | return error.CoverageNotEnabled; |
| @@ -189,6 +199,7 @@ pub fn runTestWithCoverage( | ||
| 189 | 199 | try argv.append(allocator, "zig"); |
| 190 | 200 | try argv.append(allocator, "test"); |
| 191 | 201 | try argv.append(allocator, test_file_path); |
| 202 | try argv.appendSlice(allocator, test_args); | |
| 192 | 203 | |
| 193 | 204 | const term = try compat.spawnAndWait(allocator, argv.items, .Inherit, .Inherit); |
| 194 | 205 | return switch (term) { |
| @@ -210,6 +221,7 @@ pub fn runTestWithCoverage( | ||
| 210 | 221 | try argv.append(allocator, "zig"); |
| 211 | 222 | try argv.append(allocator, "test"); |
| 212 | 223 | try argv.append(allocator, test_file_path); |
| 224 | try argv.appendSlice(allocator, test_args); | |
| 213 | 225 | |
| 214 | 226 | switch (options.tool) { |
| 215 | 227 | .kcov => { |