From 7104f88dbd89ae62dc2e96406e5109cb59a4c873 Mon Sep 17 00:00:00 2001 From: Laurent Demailly Date: Wed, 31 Jul 2024 13:39:56 -0700 Subject: [PATCH] adding deepequal interface test from #4360 (which passes, excellent) --- src/reflect/all_test.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/reflect/all_test.go b/src/reflect/all_test.go index 4c2fcc48be..738e29e48d 100644 --- a/src/reflect/all_test.go +++ b/src/reflect/all_test.go @@ -1102,6 +1102,20 @@ func init() { cycleMap3["different"] = cycleMap3 } +type deepEqualInterface interface { + Foo() +} +type deepEqualConcrete struct { + int +} + +func (deepEqualConcrete) Foo() {} + +var ( + deepEqualConcrete1 = deepEqualConcrete{1} + deepEqualConcrete2 = deepEqualConcrete{2} +) + var deepEqualTests = []DeepEqualTest{ // Equalities {nil, nil, true}, @@ -1119,6 +1133,7 @@ var deepEqualTests = []DeepEqualTest{ {[]byte{1, 2, 3}, []byte{1, 2, 3}, true}, {[]MyByte{1, 2, 3}, []MyByte{1, 2, 3}, true}, {MyBytes{1, 2, 3}, MyBytes{1, 2, 3}, true}, + {map[deepEqualInterface]string{deepEqualConcrete1: "a"}, map[deepEqualInterface]string{deepEqualConcrete1: "a"}, true}, // Inequalities {1, 2, false}, @@ -1140,6 +1155,7 @@ var deepEqualTests = []DeepEqualTest{ {fn3, fn3, false}, {[][]int{{1}}, [][]int{{2}}, false}, {&structWithSelfPtr{p: &structWithSelfPtr{s: "a"}}, &structWithSelfPtr{p: &structWithSelfPtr{s: "b"}}, false}, + {map[deepEqualInterface]string{deepEqualConcrete1: "a"}, map[deepEqualInterface]string{deepEqualConcrete2: "b"}, false}, // Fun with floating point. {math.NaN(), math.NaN(), false},