proto.Equal: document map equality and clarify the rule for repeated fields.
PiperOrigin-RevId: 130971987
diff --git a/proto/equal_test.go b/proto/equal_test.go
index 7b45eaa..a2febb3 100644
--- a/proto/equal_test.go
+++ b/proto/equal_test.go
@@ -184,6 +184,18 @@
false,
},
{
+ "zero-length maps same",
+ &pb.MessageWithMap{NameMapping: map[int32]string{}},
+ &pb.MessageWithMap{NameMapping: nil},
+ true,
+ },
+ {
+ "orders in map don't matter",
+ &pb.MessageWithMap{NameMapping: map[int32]string{1: "Ken", 2: "Rob"}},
+ &pb.MessageWithMap{NameMapping: map[int32]string{2: "Rob", 1: "Ken"}},
+ true,
+ },
+ {
"oneof same",
&pb.Communique{Union: &pb.Communique_Number{41}},
&pb.Communique{Union: &pb.Communique_Number{41}},