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
examples/timeout_examples.zigmodified+12-12
Changes to examples/timeout_examples.zig
@@ -8,7 +8,7 @@ pub fn example_per_test_timeout() !void {
88 const fastTest = struct {
99 fn run(alloc: std.mem.Allocator) !void {
1010 _ = alloc;
11 std.Thread.sleep(50 * std.time.ns_per_ms);
11 zig_test.compat.sleep(50 * std.time.ns_per_ms);
1212 std.debug.print("Fast test completed\n", .{});
1313 }
1414 }.run;
renamed throughout · 16 hidden lines
Changes to examples/timeout_examples.zig
@@ -26,14 +26,14 @@ pub fn example_suite_timeout() !void { renamed throughout
2626 const test1 = struct {
2727 fn run(alloc: std.mem.Allocator) !void {
2828 _ = alloc;
29 std.Thread.sleep(100 * std.time.ns_per_ms);
29 zig_test.compat.sleep(100 * std.time.ns_per_ms);
3030 }
3131 }.run;
3232
3333 const test2 = struct {
3434 fn run(alloc: std.mem.Allocator) !void {
3535 _ = alloc;
36 std.Thread.sleep(100 * std.time.ns_per_ms);
36 zig_test.compat.sleep(100 * std.time.ns_per_ms);
3737 }
3838 }.run;
3939
Changes to examples/timeout_examples.zig
@@ -60,7 +60,7 @@ pub fn example_timeout_context() !void {
6060 std.debug.print("Timeout context started with 1000ms timeout\n", .{});
6161
6262 // Simulate some work
63 std.Thread.sleep(200 * std.time.ns_per_ms);
63 zig_test.compat.sleep(200 * std.time.ns_per_ms);
6464
6565 if (!context.isTimedOut()) {
6666 std.debug.print("Still within timeout, elapsed: {d}ms, remaining: {d}ms\n", .{
renamed throughout · 16 hidden lines
Changes to examples/timeout_examples.zig
@@ -88,14 +88,14 @@ pub fn example_timeout_extension() !void { renamed throughout
8888 std.debug.print("Started with 500ms timeout\n", .{});
8989
9090 // Simulate work
91 std.Thread.sleep(400 * std.time.ns_per_ms);
91 zig_test.compat.sleep(400 * std.time.ns_per_ms);
9292
9393 // Need more time!
9494 try context.extend(500);
9595 std.debug.print("Extended timeout by 500ms (total: 1000ms)\n", .{});
9696
9797 // Continue work
98 std.Thread.sleep(300 * std.time.ns_per_ms);
98 zig_test.compat.sleep(300 * std.time.ns_per_ms);
9999
100100 if (!context.isTimedOut()) {
101101 std.debug.print("Completed within extended timeout\n", .{});
Changes to examples/timeout_examples.zig
@@ -165,7 +165,7 @@ pub fn example_timeout_monitoring() !void {
165165 std.debug.print("Registered context with 500ms timeout\n", .{});
166166
167167 // Simulate work
168 std.Thread.sleep(600 * std.time.ns_per_ms);
168 zig_test.compat.sleep(600 * std.time.ns_per_ms);
169169
170170 // Check if timed out
171171 if (context.isTimedOut()) {
renamed throughout · 13 hidden lines
Changes to examples/timeout_examples.zig
@@ -190,11 +190,11 @@ pub fn example_suite_tracker() !void { renamed throughout
190190
191191 // Run some tests
192192 tracker.incrementTest();
193 std.Thread.sleep(200 * std.time.ns_per_ms);
193 zig_test.compat.sleep(200 * std.time.ns_per_ms);
194194 tracker.incrementCompleted();
195195
196196 tracker.incrementTest();
197 std.Thread.sleep(200 * std.time.ns_per_ms);
197 zig_test.compat.sleep(200 * std.time.ns_per_ms);
198198 tracker.incrementCompleted();
199199
200200 std.debug.print("Tests run: {d}/{d}\n", .{ tracker.completed_count, tracker.test_count });
Changes to examples/timeout_examples.zig
@@ -240,7 +240,7 @@ pub fn example_async_with_timeout() !void {
240240 const asyncTest = struct {
241241 fn run(alloc: std.mem.Allocator) !void {
242242 _ = alloc;
243 std.Thread.sleep(100 * std.time.ns_per_ms);
243 zig_test.compat.sleep(100 * std.time.ns_per_ms);
244244 std.debug.print("Async test completed\n", .{});
245245 }
246246 }.run;
renamed throughout · 14 hidden lines
Changes to examples/timeout_examples.zig
@@ -258,12 +258,12 @@ pub fn example_timeout_result() !void { renamed throughout
258258 var context = zig_test.TimeoutContext.init(allocator, 1000);
259259 context.start();
260260
261 std.Thread.sleep(150 * std.time.ns_per_ms);
261 zig_test.compat.sleep(150 * std.time.ns_per_ms);
262262
263263 // Extend timeout
264264 try context.extend(500);
265265
266 std.Thread.sleep(100 * std.time.ns_per_ms);
266 zig_test.compat.sleep(100 * std.time.ns_per_ms);
267267
268268 context.complete();
269269