From 5ab5113077bf82237978168b32e2b549a4a71feb Mon Sep 17 00:00:00 2001 From: Benjamin Thompson Date: Sat, 15 Feb 2025 12:41:58 +1000 Subject: added expectEqualDeep test coverage for issue 16625 (#22781) --- lib/std/testing.zig | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib/std/testing.zig') diff --git a/lib/std/testing.zig b/lib/std/testing.zig index a0fcc8797f..d0a5eddf4e 100644 --- a/lib/std/testing.zig +++ b/lib/std/testing.zig @@ -932,6 +932,19 @@ test "expectEqualDeep composite type" { try expectEqualDeep(a, b); try expectEqualDeep(&a, &b); } + + // inferred union + const TestStruct2 = struct { + const A = union(enum) { b: B, c: C }; + const B = struct {}; + const C = struct { a: *const A }; + }; + + const union1 = TestStruct2.A{ .b = .{} }; + try expectEqualDeep( + TestStruct2.A{ .c = .{ .a = &union1 } }, + TestStruct2.A{ .c = .{ .a = &union1 } }, + ); } fn printIndicatorLine(source: []const u8, indicator_index: usize) void { -- cgit v1.2.3