mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
std.testing: Fix expectEqualDeep formatted enum (#25960)
This commit is contained in:
parent
e4be00f949
commit
14ba3bd9a1
@ -760,7 +760,7 @@ fn expectEqualDeepInner(comptime T: type, expected: T, actual: T) error{TestExpe
|
|||||||
.error_set,
|
.error_set,
|
||||||
=> {
|
=> {
|
||||||
if (actual != expected) {
|
if (actual != expected) {
|
||||||
print("expected {}, found {}\n", .{ expected, actual });
|
print("expected {any}, found {any}\n", .{ expected, actual });
|
||||||
return error.TestExpectedEqual;
|
return error.TestExpectedEqual;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -923,6 +923,18 @@ test "expectEqualDeep primitive type" {
|
|||||||
}.foo;
|
}.foo;
|
||||||
try expectEqualDeep(fnType, fnType);
|
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" {
|
test "expectEqualDeep pointer" {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user