mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 07:03:29 +00:00
fix tests
This commit is contained in:
@@ -180,8 +180,8 @@ test "Browser.Console" {
|
|||||||
}, .{});
|
}, .{});
|
||||||
|
|
||||||
const captured = test_capture.captured.items;
|
const captured = test_capture.captured.items;
|
||||||
try testing.expectEqual("[info] args=a", captured[0]);
|
try testing.expectEqual("[info] args= 1: a", captured[0]);
|
||||||
try testing.expectEqual("[warn] args=hello world 23 true [object Object]", captured[1]);
|
try testing.expectEqual("[warn] args= 1: hello world 2: 23 3: true 4: #<Object>", captured[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -222,13 +222,17 @@ test "Browser.Console" {
|
|||||||
|
|
||||||
const captured = test_capture.captured.items;
|
const captured = test_capture.captured.items;
|
||||||
try testing.expectEqual("[assertion failed] values=", captured[0]);
|
try testing.expectEqual("[assertion failed] values=", captured[0]);
|
||||||
try testing.expectEqual("[assertion failed] values=x true", captured[1]);
|
try testing.expectEqual("[assertion failed] values= 1: x 2: true", captured[1]);
|
||||||
try testing.expectEqual("[assertion failed] values=x", captured[2]);
|
try testing.expectEqual("[assertion failed] values= 1: x", captured[2]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const TestCapture = struct {
|
const TestCapture = struct {
|
||||||
captured: std.ArrayListUnmanaged([]const u8) = .{},
|
captured: std.ArrayListUnmanaged([]const u8) = .{},
|
||||||
|
|
||||||
|
fn separator(_: *const TestCapture) []const u8 {
|
||||||
|
return " ";
|
||||||
|
}
|
||||||
|
|
||||||
fn reset(self: *TestCapture) void {
|
fn reset(self: *TestCapture) void {
|
||||||
self.captured = .{};
|
self.captured = .{};
|
||||||
}
|
}
|
||||||
@@ -269,6 +273,15 @@ const TestCapture = struct {
|
|||||||
self.capture(scope, msg, args);
|
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(
|
fn capture(
|
||||||
self: *TestCapture,
|
self: *TestCapture,
|
||||||
comptime scope: @Type(.enum_literal),
|
comptime scope: @Type(.enum_literal),
|
||||||
|
|||||||
Reference in New Issue
Block a user