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
tests/cli_test.zigmodified+18-12
Changes to tests/cli_test.zig
@@ -1,19 +1,25 @@
11const std = ;
2const ztf = ;
23
3// Placeholder tests for CLI module
4// TODO: Implement comprehensive tests for CLI parsing
5
6test "CLI parse help flag" {
7 // Test --help flag parsing
8 try std.testing.expect(true);
4test "CLI parses the help flag" {
5 var cli = ztf.CLI.init(std.testing.allocator);
6 try cli.parse(&.{ "zig-test", "--help" });
7 try std.testing.expect(cli.options.help);
98}
109
11test "CLI parse reporter option" {
12 // Test --reporter option parsing
13 try std.testing.expect(true);
10test "CLI parses a representative discovery invocation" {
11 var cli = ztf.CLI.init(std.testing.allocator);
12 try cli.parse(&.{ "zig-test", "--test-dir", "specs", "--grep", "database", "--coverage", "--no-color", "--bail" });
13 try std.testing.expectEqualStrings("specs", cli.options.test_dir.?);
14 try std.testing.expectEqualStrings("database", cli.options.filter.?);
15 try std.testing.expect(cli.options.coverage);
16 try std.testing.expect(cli.options.no_color);
17 try std.testing.expect(cli.options.bail);
1418}
1519
16test "CLI parse filter option" {
17 // Test --filter option parsing
18 try std.testing.expect(true);
20test "CLI rejects missing and invalid values" {
21 var missing = ztf.CLI.init(std.testing.allocator);
22 try std.testing.expectError(ztf.cli.CLIError.MissingValue, missing.parse(&.{ "zig-test", "--reporter" }));
23 var invalid = ztf.CLI.init(std.testing.allocator);
24 try std.testing.expectError(ztf.cli.CLIError.InvalidArgument, invalid.parse(&.{ "zig-test", "--jobs", "0" }));
1925}