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/assertions_test.zigmodified+23-12
Changes to tests/assertions_test.zig
@@ -1,19 +1,30 @@
11const std = ;
2const ztf = ;
23
3// Placeholder tests for assertions module
4// TODO: Implement comprehensive tests for all assertion methods
5
6test "assertions basic equality" {
7 // Test toBe and toEqual
8 try std.testing.expect(true);
4test "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));
99}
1010
11test "assertions comparison operators" {
12 // Test toBeGreaterThan, toBeLessThan, etc.
13 try std.testing.expect(true);
11test "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();
1417}
1518
16test "assertions string operations" {
17 // Test string-specific assertions
18 try std.testing.expect(true);
19test "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);
1930}