You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Comparison of proto Messages performed using ShouldResemble is unreliable.
Consider this code:
package main
import (
. "github.com/smartystreets/goconvey/convey"
"google.golang.org/protobuf/types/known/wrapperspb"
"log"
"testing"
)
func TestConveyBug(t *testing.T) {
Convey("Given something", t, func() {
var x = &wrapperspb.BoolValue{Value: false}
var y = &wrapperspb.BoolValue{Value: false}
log.Printf("Receive type %v", x)
So(x, ShouldResemble, y)
})
}
The call to Printf causes x.String() to be called. This in turn initializes the state and its atomicMessageInfo field on the proto message. Therefore x has the atomicMessageInfo set, while y doesn't. This causes reflect.DeepEqual to return false.
Another problem stems from the rendering of the diff (#660).
Could a ShouldResembleProto be added for expliciting comparing proto messages? It should call proto.Equal.
The text was updated successfully, but these errors were encountered:
Hey Antonio, note that you can define your own ShouldResembleProto and use that with GoConvey. That's exactly what the Chrome infrastructure team has done, as they're big users of GoConvey and of Protocol Buffers. I'd be curious for @riannucci to chime in, but it might be weird for GoConvey to pull in the protobuf repo as a dependency to make this natively supported.
Comparison of proto Messages performed using
ShouldResemble
is unreliable.Consider this code:
The call to
Printf
causesx.String()
to be called. This in turn initializes thestate
and itsatomicMessageInfo
field on the proto message. Thereforex
has theatomicMessageInfo
set, whiley
doesn't. This causesreflect.DeepEqual
to return false.Another problem stems from the rendering of the diff (#660).
Could a
ShouldResembleProto
be added for expliciting comparing proto messages? It should callproto.Equal
.The text was updated successfully, but these errors were encountered: