From 625fa03c221b232c5e55fcf33a9f6b94dc3953fc Mon Sep 17 00:00:00 2001 From: Karl Seguin Date: Sat, 31 May 2025 21:38:24 +0800 Subject: [PATCH] fix tests --- src/browser/console/console.zig | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/browser/console/console.zig b/src/browser/console/console.zig index 980c6aaa..20148b8a 100644 --- a/src/browser/console/console.zig +++ b/src/browser/console/console.zig @@ -180,8 +180,8 @@ test "Browser.Console" { }, .{}); const captured = test_capture.captured.items; - try testing.expectEqual("[info] args=a", captured[0]); - try testing.expectEqual("[warn] args=hello world 23 true [object Object]", captured[1]); + try testing.expectEqual("[info] args= 1: a", captured[0]); + try testing.expectEqual("[warn] args= 1: hello world 2: 23 3: true 4: #", captured[1]); } { @@ -222,13 +222,17 @@ test "Browser.Console" { const captured = test_capture.captured.items; try testing.expectEqual("[assertion failed] values=", captured[0]); - try testing.expectEqual("[assertion failed] values=x true", captured[1]); - try testing.expectEqual("[assertion failed] values=x", captured[2]); + try testing.expectEqual("[assertion failed] values= 1: x 2: true", captured[1]); + try testing.expectEqual("[assertion failed] values= 1: x", captured[2]); } } const TestCapture = struct { captured: std.ArrayListUnmanaged([]const u8) = .{}, + fn separator(_: *const TestCapture) []const u8 { + return " "; + } + fn reset(self: *TestCapture) void { self.captured = .{}; } @@ -269,6 +273,15 @@ const TestCapture = struct { self.capture(scope, msg, args); } + fn fatal( + self: *TestCapture, + comptime scope: @Type(.enum_literal), + comptime msg: []const u8, + args: anytype, + ) void { + self.capture(scope, msg, args); + } + fn capture( self: *TestCapture, comptime scope: @Type(.enum_literal),