also looking at this
test: make CI exercise maintained integrations
#18
16 files
+390
-139
| @@ -1,19 +1,30 @@ | ||
| 1 | 1 | const std = ; |
| 2 | const ztf = ; | |
| 2 | 3 | |
| 3 | // Placeholder tests for assertions module | |
| 4 | // TODO: Implement comprehensive tests for all assertion methods | |
| 5 | ||
| 6 | test "assertions basic equality" { | |
| 7 | // Test toBe and toEqual | |
| 8 | try std.testing.expect(true); | |
| 4 | test "assertions report equality failures and support negation" { | |
| 5 | const allocator = std.testing.allocator; | |
| 6 | try ztf.expect(allocator, @as(i32, 42)).toBe(42); | |
| 7 | try ztf.expect(allocator, @as(i32, 42)).not().toBe(7); | |
| 8 | try std.testing.expectError(ztf.AssertionError.AssertionFailed, ztf.expect(allocator, @as(i32, 42)).toBe(7)); | |
| 9 | 9 | } |
| 10 | 10 | |
| 11 | test "assertions comparison operators" { | |
| 12 | // Test toBeGreaterThan, toBeLessThan, etc. | |
| 13 | try std.testing.expect(true); | |
| 11 | test "assertions cover comparisons and optionals" { | |
| 12 | const allocator = std.testing.allocator; | |
| 13 | try ztf.expect(allocator, @as(i32, 10)).toBeGreaterThan(5); | |
| 14 | try ztf.expect(allocator, @as(i32, 5)).toBeLessThan(10); | |
| 15 | try ztf.expect(allocator, @as(?i32, null)).toBeNull(); | |
| 16 | try ztf.expect(allocator, @as(?i32, 3)).toBeDefined(); | |
| 14 | 17 | } |
| 15 | 18 | |
| 16 | test "assertions string operations" { | |
| 17 | // Test string-specific assertions | |
| 18 | try std.testing.expect(true); | |
| 19 | test "assertions cover strings and error unions" { | |
| 20 | const allocator = std.testing.allocator; | |
| 21 | const Failing = struct { | |
| 22 | fn call() !void { | |
| 23 | return error.ExpectedFailure; | |
| 24 | } | |
| 25 | }; | |
| 26 | try ztf.expect(allocator, "zig test framework").toContain("test"); | |
| 27 | try ztf.expect(allocator, "zig test framework").toStartWith("zig"); | |
| 28 | try ztf.expect(allocator, "zig test framework").toEndWith("framework"); | |
| 29 | try ztf.expect(allocator, Failing.call).toThrowError(error.ExpectedFailure); | |
| 19 | 30 | } |