Use proto.Equal for equalities on Go proto messages (#1204)
This commit is contained in:
Родитель
c73e0165df
Коммит
a7fee9febf
|
@ -94,7 +94,7 @@ func TestFileDescForType(t *testing.T) {
|
|||
{reflect.TypeOf(pb.ToBeExtended{}), fdProto2},
|
||||
} {
|
||||
fd, err := s.fileDescForType(test.st)
|
||||
if err != nil || !reflect.DeepEqual(fd, test.wantFd) {
|
||||
if err != nil || !proto.Equal(fd, test.wantFd) {
|
||||
t.Errorf("fileDescForType(%q) = %q, %v, want %q, <nil>", test.st, fd, err, test.wantFd)
|
||||
}
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ func TestFileDescContainingExtension(t *testing.T) {
|
|||
{reflect.TypeOf(pb.ToBeExtended{}), 29, fdProto2Ext2},
|
||||
} {
|
||||
fd, err := s.fileDescContainingExtension(test.st, test.extNum)
|
||||
if err != nil || !reflect.DeepEqual(fd, test.want) {
|
||||
if err != nil || !proto.Equal(fd, test.want) {
|
||||
t.Errorf("fileDescContainingExtension(%q) = %q, %v, want %q, <nil>", test.st, fd, err, test.want)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@ import (
|
|||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/golang/protobuf/proto"
|
||||
apb "github.com/golang/protobuf/ptypes/any"
|
||||
spb "google.golang.org/genproto/googleapis/rpc/status"
|
||||
"google.golang.org/grpc/codes"
|
||||
|
@ -59,7 +60,7 @@ func TestFromToProto(t *testing.T) {
|
|||
}
|
||||
|
||||
err := FromProto(s)
|
||||
if got := err.Proto(); !reflect.DeepEqual(s, got) {
|
||||
if got := err.Proto(); !proto.Equal(s, got) {
|
||||
t.Fatalf("Expected errors to be identical - s: %v got: %v", s, got)
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче