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/matchers_test.zigmodified+19-12
Changes to tests/matchers_test.zig
@@ -1,19 +1,26 @@
11const std = ;
2const ztf = ;
23
3// Placeholder tests for matchers module
4// TODO: Implement comprehensive tests for advanced matchers
5
6test "matchers numeric operations" {
7 // Test toBeCloseTo, toBeNaN, etc.
8 try std.testing.expect(true);
4test "numeric matchers accept special and approximate values" {
5 try ztf.toBeCloseTo(0.1 + 0.2, 0.3, 10);
6 try ztf.toBeNaN(std.math.nan(f64));
7 try ztf.toBeInfinite(std.math.inf(f64));
8 try std.testing.expectError(ztf.AssertionError.AssertionFailed, ztf.toBeCloseTo(1.0, 2.0, 4));
99}
1010
11test "matchers array operations" {
12 // Test array-specific matchers
13 try std.testing.expect(true);
11test "array matchers inspect contents and length" {
12 const values = [_]i32{ 1, 2, 3, 5, 8 };
13 const matcher = ztf.expectArray(std.testing.allocator, &values);
14 try matcher.toHaveLength(5);
15 try matcher.toContain(5);
16 try matcher.toContainAll(&.{ 1, 3, 8 });
17 try std.testing.expectError(ztf.AssertionError.AssertionFailed, matcher.toContain(13));
1418}
1519
16test "matchers struct operations" {
17 // Test struct-specific matchers
18 try std.testing.expect(true);
20test "struct matchers inspect named fields" {
21 const User = struct { name: []const u8, active: bool };
22 const matcher = ztf.expectStruct(std.testing.allocator, User{ .name = "Ada", .active = true });
23 try matcher.toHaveField("name", "Ada");
24 try matcher.toHaveField("active", true);
25 try std.testing.expectError(ztf.AssertionError.AssertionFailed, matcher.toHaveField("name", "Grace"));
1926}