also looking at this
test: make CI exercise maintained integrations
#18
16 files
+390
-139
| @@ -1,19 +1,26 @@ | ||
| 1 | 1 | const std = ; |
| 2 | const ztf = ; | |
| 2 | 3 | |
| 3 | // Placeholder tests for matchers module | |
| 4 | // TODO: Implement comprehensive tests for advanced matchers | |
| 5 | ||
| 6 | test "matchers numeric operations" { | |
| 7 | // Test toBeCloseTo, toBeNaN, etc. | |
| 8 | try std.testing.expect(true); | |
| 4 | test "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)); | |
| 9 | 9 | } |
| 10 | 10 | |
| 11 | test "matchers array operations" { | |
| 12 | // Test array-specific matchers | |
| 13 | try std.testing.expect(true); | |
| 11 | test "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)); | |
| 14 | 18 | } |
| 15 | 19 | |
| 16 | test "matchers struct operations" { | |
| 17 | // Test struct-specific matchers | |
| 18 | try std.testing.expect(true); | |
| 20 | test "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")); | |
| 19 | 26 | } |