@@ -49,12 +49,12 @@ func ProtoEqual(expected proto.Message) types.GomegaMatcher {
4949 }
5050}
5151
52- // ProtoContainsMatcher is a custom Gomega matcher to check if a slice of protocol buffers contains specific elements
53- type ProtoContainsMatcher struct {
52+ // ProtoConsistOfMatcher is a custom Gomega matcher to check if a slice of protocol buffers contains specific elements
53+ type ProtoConsistOfMatcher struct {
5454 Elements []proto.Message
5555}
5656
57- func (matcher * ProtoContainsMatcher ) Match (actual interface {}) (success bool , err error ) {
57+ func (matcher * ProtoConsistOfMatcher ) Match (actual interface {}) (success bool , err error ) {
5858 v := reflect .ValueOf (actual )
5959 if v .Kind () != reflect .Slice {
6060 return false , nil
@@ -87,15 +87,15 @@ func (matcher *ProtoContainsMatcher) Match(actual interface{}) (success bool, er
8787 return true , nil
8888}
8989
90- func (matcher * ProtoContainsMatcher ) FailureMessage (actual interface {}) (message string ) {
90+ func (matcher * ProtoConsistOfMatcher ) FailureMessage (actual interface {}) (message string ) {
9191 return format .Message (actual , "to contain elements" , matcher .Elements )
9292}
9393
94- func (matcher * ProtoContainsMatcher ) NegatedFailureMessage (actual interface {}) (message string ) {
94+ func (matcher * ProtoConsistOfMatcher ) NegatedFailureMessage (actual interface {}) (message string ) {
9595 return format .Message (actual , "not to contain elements" , matcher .Elements )
9696}
9797
98- // ProtoContains returns a Gomega matcher that checks if a slice of Protobuf messages contains all the specified elements.
98+ // ProtoConsistOf returns a Gomega matcher that checks if a slice of Protobuf messages contains all the specified elements.
9999// It verifies that the input is a slice of proto.Message implementations and that each specified element is present in the
100100// actual slice (in any order), using proto.Equal for comparisons. The actual slice may contain additional elements beyond
101101// those specified.
@@ -106,16 +106,16 @@ func (matcher *ProtoContainsMatcher) NegatedFailureMessage(actual interface{}) (
106106//
107107// Example usage:
108108//
109- // Expect(items).To(ProtoContains (
109+ // Expect(items).To(ProtoConsistOf (
110110// &v1.Foo{Bar: "test1"},
111111// &v1.Foo{Bar: "test2"},
112112// )) // Passes if items contains both elements (and possibly more)
113- // Expect(missing).ToNot(ProtoContains (
113+ // Expect(missing).ToNot(ProtoConsistOf (
114114// &v1.Foo{Bar: "test1"},
115115// &v1.Foo{Bar: "test2"},
116116// )) // Passes if missing lacks at least one of these elements
117- func ProtoContains (elements ... proto.Message ) types.GomegaMatcher {
118- return & ProtoContainsMatcher {
117+ func ProtoConsistOf (elements ... proto.Message ) types.GomegaMatcher {
118+ return & ProtoConsistOfMatcher {
119119 Elements : elements ,
120120 }
121121}
0 commit comments