mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
std.testing: Fix expectEqualDeep formatted enum (#25960)
This commit is contained in:
parent
e4be00f949
commit
14ba3bd9a1
1 changed files with 13 additions and 1 deletions
|
|
@ -760,7 +760,7 @@ fn expectEqualDeepInner(comptime T: type, expected: T, actual: T) error{TestExpe
|
|||
.error_set,
|
||||
=> {
|
||||
if (actual != expected) {
|
||||
print("expected {}, found {}\n", .{ expected, actual });
|
||||
print("expected {any}, found {any}\n", .{ expected, actual });
|
||||
return error.TestExpectedEqual;
|
||||
}
|
||||
},
|
||||
|
|
@ -923,6 +923,18 @@ test "expectEqualDeep primitive type" {
|
|||
}.foo;
|
||||
try expectEqualDeep(fnType, fnType);
|
||||
}
|
||||
// enum with formatter
|
||||
{
|
||||
const TestEnum = enum {
|
||||
a,
|
||||
b,
|
||||
|
||||
pub fn format(self: @This(), writer: *std.Io.Writer) !void {
|
||||
try writer.writeAll(@tagName(self));
|
||||
}
|
||||
};
|
||||
try expectEqualDeep(TestEnum.b, TestEnum.b);
|
||||
}
|
||||
}
|
||||
|
||||
test "expectEqualDeep pointer" {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue