ReviewOS

also looking at this

zig-utils/zig-test-framework

build: single-source the package and CLI version

#20
Merged glennmichael123 wants to merge codex/issue-13-version into main
7 files +40 -11
src/cli.zigmodified+8-2
Changes to src/cli.zig
@@ -1,4 +1,5 @@
11const std = ;
2const build_options = ;
23const config_mod = ;
34const test_runner = ;
45
@@ -44,6 +45,8 @@ pub const CLIOptions = struct {
4445 timeout: ?u64 = null, // Global timeout in milliseconds
4546};
4647
48pub const version = build_options.version;
49
4750pub const CLIError = error{
4851 InvalidArgument,
4952 MissingValue,
@@ -383,8 +386,7 @@ pub const CLI = struct {
383386 /// Print version information
384387 pub fn printVersion(self: Self) void {
385388 _ = 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});
388390 }
389391
390392 /// Convert CLI options to RunnerOptions
@@ -423,6 +425,10 @@ test "CLI parse version" {
423425 try std.testing.expect(cli.options.version);
424426}
425427
428test "CLI build version is valid semantic version metadata" {
429 _ = try std.SemanticVersion.parse(version);
430}
431
426432test "CLI parse bail" {
427433 var cli = CLI.init(std.testing.allocator);
428434 const args = [_][]const u8{ "zig-test", "--bail" };