Skip to content

Commit

Permalink
Use proto.Equal for equalities on Go proto messages (#1204)
Browse files Browse the repository at this point in the history
  • Loading branch information
menghanl committed Apr 27, 2017
1 parent c73e016 commit a7fee9f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions reflection/serverreflection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down Expand Up @@ -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)
}
}
Expand Down
3 changes: 2 additions & 1 deletion status/status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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)
}
}
Expand Down

0 comments on commit a7fee9f

Please sign in to comment.