aboutsummaryrefslogtreecommitdiff
path: root/lib/std
diff options
context:
space:
mode:
authorBenjamin Thompson <bgt37@cornell.edu>2025-02-15 12:41:58 +1000
committerGitHub <noreply@github.com>2025-02-15 03:41:58 +0100
commit5ab5113077bf82237978168b32e2b549a4a71feb (patch)
treed86af729402d6ac5fff58c907067c5e0054a0260 /lib/std
parent13ad984b1f403c240ee677c32c2b43980d098be3 (diff)
downloadzig-5ab5113077bf82237978168b32e2b549a4a71feb.tar.gz
zig-5ab5113077bf82237978168b32e2b549a4a71feb.zip
added expectEqualDeep test coverage for issue 16625 (#22781)
Diffstat (limited to 'lib/std')
-rw-r--r--lib/std/testing.zig13
1 files changed, 13 insertions, 0 deletions
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 {