From 1e3d9579ca92d7c98dc1642228c776db1ee0cefd Mon Sep 17 00:00:00 2001 From: Techatrix <19954306+Techatrix@users.noreply.github.com> Date: Thu, 19 Jan 2023 19:15:52 +0100 Subject: [PATCH] improve peer type resolution test failure message --- src/InternPool.zig | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/InternPool.zig b/src/InternPool.zig index 0437b18..0d6fae5 100644 --- a/src/InternPool.zig +++ b/src/InternPool.zig @@ -446,6 +446,10 @@ pub const Key = union(enum) { } fn printType(ty: Index, ip: InternPool, writer: anytype) @TypeOf(writer).Error!void { + if (builtin.is_test and ty == .none) { + try writer.writeAll(@tagName(Index.none)); + return; + } try printTypeKey(ip.indexToKey(ty), ip, writer); } @@ -3178,5 +3182,8 @@ fn testResolvePeerTypes(ip: *InternPool, a: Index, b: Index, expected: Index) !v fn testResolvePeerTypesInOrder(ip: *InternPool, lhs: Index, rhs: Index, expected: Index) !void { const actual = try resolvePeerTypes(ip, std.testing.allocator, &.{ lhs, rhs }, builtin.target); - try std.testing.expectEqual(expected, actual); + if (expected != actual) { + std.debug.print("expected {}, found {}\n", .{ expected.fmtType(ip.*), actual.fmtType(ip.*) }); + return error.TestExpectedEqual; + } }