//MatchAllElements succeeds if every element of a slice matches the element matcher it maps to //through the id function, and every element matcher is matched. // idFn := func(element interface{}) string { // return fmt.Sprintf("%v", element) // } // // Expect([]string{"a", "b"}).To(MatchAllElements(idFn, Elements{ // "a": Equal("a"), // "b": Equal("b"), // })) func MatchAllElements(identifier Identifier, elements Elements) types.GomegaMatcher { … } //MatchAllElementsWithIndex succeeds if every element of a slice matches the element matcher it maps to //through the id with index function, and every element matcher is matched. // idFn := func(index int, element interface{}) string { // return strconv.Itoa(index) // } // // Expect([]string{"a", "b"}).To(MatchAllElements(idFn, Elements{ // "0": Equal("a"), // "1": Equal("b"), // })) func MatchAllElementsWithIndex(identifier IdentifierWithIndex, elements Elements) types.GomegaMatcher { … } //MatchElements succeeds if each element of a slice matches the element matcher it maps to //through the id function. It can ignore extra elements and/or missing elements. // idFn := func(element interface{}) string { // return fmt.Sprintf("%v", element) // } // // Expect([]string{"a", "b", "c"}).To(MatchElements(idFn, IgnoreExtras, Elements{ // "a": Equal("a"), // "b": Equal("b"), // })) // Expect([]string{"a", "c"}).To(MatchElements(idFn, IgnoreMissing, Elements{ // "a": Equal("a"), // "b": Equal("b"), // "c": Equal("c"), // "d": Equal("d"), // })) func MatchElements(identifier Identifier, options Options, elements Elements) types.GomegaMatcher { … } //MatchElementsWithIndex succeeds if each element of a slice matches the element matcher it maps to //through the id with index function. It can ignore extra elements and/or missing elements. // idFn := func(index int, element interface{}) string { // return strconv.Itoa(index) // } // // Expect([]string{"a", "b", "c"}).To(MatchElements(idFn, IgnoreExtras, Elements{ // "0": Equal("a"), // "1": Equal("b"), // })) // Expect([]string{"a", "c"}).To(MatchElements(idFn, IgnoreMissing, Elements{ // "0": Equal("a"), // "1": Equal("b"), // "2": Equal("c"), // "3": Equal("d"), // })) func MatchElementsWithIndex(identifier IdentifierWithIndex, options Options, elements Elements) types.GomegaMatcher { … } type ElementsMatcher … type Elements … type Identifier … // Calls the underlying fucntion with the provided params. // Identifier drops the index. func (i Identifier) WithIndexAndElement(index int, element interface{ … } type IdentifierWithIndex … // Calls the underlying fucntion with the provided params. // IdentifierWithIndex uses the index. func (i IdentifierWithIndex) WithIndexAndElement(index int, element interface{ … } type Identify … // IndexIdentity is a helper function for using an index as // the key in the element map func IndexIdentity(index int, _ interface{ … } func (m *ElementsMatcher) Match(actual interface{ … } func (m *ElementsMatcher) matchElements(actual interface{ … } func (m *ElementsMatcher) FailureMessage(actual interface{ … } func (m *ElementsMatcher) NegatedFailureMessage(actual interface{ … } func (m *ElementsMatcher) Failures() []error { … }