also looking at this
build: single-source the package and CLI version
#20
7 files
+40
-11
| @@ -1,4 +1,5 @@ | ||
| 1 | 1 | const std = ; |
| 2 | const build_options = ; | |
| 2 | 3 | const config_mod = ; |
| 3 | 4 | const test_runner = ; |
| 4 | 5 | |
| @@ -44,6 +45,8 @@ pub const CLIOptions = struct { | ||
| 44 | 45 | timeout: ?u64 = null, // Global timeout in milliseconds |
| 45 | 46 | }; |
| 46 | 47 | |
| 48 | pub const version = build_options.version; | |
| 49 | ||
| 47 | 50 | pub const CLIError = error{ |
| 48 | 51 | InvalidArgument, |
| 49 | 52 | MissingValue, |
| @@ -383,8 +386,7 @@ pub const CLI = struct { | ||
| 383 | 386 | /// Print version information |
| 384 | 387 | pub fn printVersion(self: Self) void { |
| 385 | 388 | _ = self; |
| 386 | std.debug.print("Zig Test Framework v2.5.0\n", .{}); | |
| 387 | std.debug.print("Features: Parallel, Coverage, UI, Snapshots, Watch, Memory Profiling, TAP/JUnit, Progress Indicators, Timeout\n", .{}); | |
| 389 | std.debug.print("Zig Test Framework v{s}\n", .{version}); | |
| 388 | 390 | } |
| 389 | 391 | |
| 390 | 392 | /// Convert CLI options to RunnerOptions |
| @@ -423,6 +425,10 @@ test "CLI parse version" { | ||
| 423 | 425 | try std.testing.expect(cli.options.version); |
| 424 | 426 | } |
| 425 | 427 | |
| 428 | test "CLI build version is valid semantic version metadata" { | |
| 429 | _ = try std.SemanticVersion.parse(version); | |
| 430 | } | |
| 431 | ||
| 426 | 432 | test "CLI parse bail" { |
| 427 | 433 | var cli = CLI.init(std.testing.allocator); |
| 428 | 434 | const args = [_][]const u8{ "zig-test", "--bail" }; |