Documentation ¶
Index ¶
Constants ¶
const ( // ExistsMatcher defines special matcher to match non-existent key ExistsMatcher = "$exists" // RegexpMatcher defines matcher to match regexp RegexpMatcher = "$regexp" )
Variables ¶
This section is empty.
Functions ¶
func MatchMap ¶
func MatchMap(fields Fields, exists map[string]bool) types.GomegaMatcher
MatchMap succeeds if every field of a struct matches the field matcher associated with it, and every element matcher is matched.
Expect([]string{"a", "b"}).To(MatchAllFields(idFn, gstruct.Fields{ "a": BeEqual("a"), "b": BeEqual("b"), })
func MatchSlice ¶
func MatchSlice(elements Elements) types.GomegaMatcher
MatchSlice succeeds if every element of a slice matches the element matcher it maps to through the id function, and every element matcher is matched.
Expect([]string{"a", "b"}).To(MatchAllElements(idFn, matchers.Elements{ "a": BeEqual("a"), "b": BeEqual("b"), })
func Parse ¶
func Parse(matcher string) (gomegatypes.GomegaMatcher, error)
Parse parse matcher of response and returns GomegaMatcher
Types ¶
type FieldsMatcher ¶
type FieldsMatcher struct { // Matchers for each field. Fields Fields // Exists defines existence of fields // If field is not in it, it will not be // checked for existence Exists map[string]bool // contains filtered or unexported fields }
FieldsMatcher for map
func (*FieldsMatcher) FailureMessage ¶
func (m *FieldsMatcher) FailureMessage(actual interface{}) (message string)
FailureMessage implements types.GomegaMatcher
func (*FieldsMatcher) Failures ¶
func (m *FieldsMatcher) Failures() []error
Failures returns all errors
func (*FieldsMatcher) Match ¶
func (m *FieldsMatcher) Match(actual interface{}) (success bool, err error)
Match implements types.GomegaMatcher
func (*FieldsMatcher) NegatedFailureMessage ¶
func (m *FieldsMatcher) NegatedFailureMessage(actual interface{}) (message string)
NegatedFailureMessage implements types.GomegaMatcher
type Matcher ¶
type Matcher struct { // Matchers for each element. Elements Elements // contains filtered or unexported fields }
Matcher is a NestingMatcher that applies custom matchers to each element of a slice mapped by the Identifier function. TODO: Extend this to work with arrays & maps (map the key) as well.
func (*Matcher) FailureMessage ¶
FailureMessage implements types.GomegaMatcher
func (*Matcher) NegatedFailureMessage ¶
NegatedFailureMessage implements types.GomegaMatcher