mirror of
https://github.com/ziglang/zig.git
synced 2026-01-20 22:35:24 +00:00
std.testing: expectEqualDeep() - support self-referential structs
This commit is contained in:
parent
80ae27bc84
commit
759b0fe00a
@ -691,8 +691,9 @@ pub fn expectStringEndsWith(actual: []const u8, expected_ends_with: []const u8)
|
|||||||
/// Container types(like Array/Slice/Vector) deeply equal when their corresponding elements are deeply equal.
|
/// Container types(like Array/Slice/Vector) deeply equal when their corresponding elements are deeply equal.
|
||||||
/// Pointer values are deeply equal if values they point to are deeply equal.
|
/// Pointer values are deeply equal if values they point to are deeply equal.
|
||||||
///
|
///
|
||||||
/// Note: Self-referential structs are not supported (e.g. things like std.SinglyLinkedList)
|
/// Note: Self-referential structs are supported (e.g. things like std.SinglyLinkedList)
|
||||||
pub fn expectEqualDeep(expected: anytype, actual: @TypeOf(expected)) !void {
|
/// but may cause infinite recursion or stack overflow when a container has a pointer to itself.
|
||||||
|
pub fn expectEqualDeep(expected: anytype, actual: @TypeOf(expected)) error{TestExpectedEqual}!void {
|
||||||
switch (@typeInfo(@TypeOf(actual))) {
|
switch (@typeInfo(@TypeOf(actual))) {
|
||||||
.NoReturn,
|
.NoReturn,
|
||||||
.Opaque,
|
.Opaque,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user