Commit Graph

2 Commits

Author SHA1 Message Date
Joe Tsai
c14e7899f9 testing/protocmp: fix reflection handling of extensions
Extensions should be checked based on ContainingMessage,
rather than the Parent. Add tests to ensure this works.

Change-Id: Iaf257f65197fb8d332039bc77a192753f8c4159f
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/221426
Reviewed-by: Damien Neil <dneil@google.com>
2020-02-28 21:49:08 +00:00
Joe Tsai
a89afdc06f testing/protocmp: make Message implement proto.Message
By having the Message type implement proto.Message, it can be passed
to other general-purpose protobuf functions such as proto.Merge.
This provides a convenient way to convert the Message back into a
concrete form that may be easier to work with.

A minor consequence of this change is that invalid messages are
converted to an invalid Message that preserves type information.
Previously, they were simply transformed to a nil Message.

Change-Id: I6fca8a0879408c7f44a99d52734613302fa23f70
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/221422
Reviewed-by: Damien Neil <dneil@google.com>
2020-02-27 23:32:22 +00:00