func (m *OrMatcher) MatchMayChangeInTheFuture(actual interface{}) bool { /* Example with 3 matchers: A, B, C Match evaluates them: F, T, <?> => T So match is currently T, what should MatchMayChangeInTheFuture() return? Seems like it only depends on B, since currently B MUST change to allow the result to become F Match eval: F, F, F => F So match is currently F, what should MatchMayChangeInTheFuture() return? Seems to depend on ANY of them being able to change to T. */ if m.firstSuccessfulMatcher != nil { // one of the matchers succeeded.. it must be able to change in order to affect the result return oraclematcher.MatchMayChangeInTheFuture(m.firstSuccessfulMatcher, actual) } else { // so all matchers failed.. Any one of them changing would change the result. for _, matcher := range m.Matchers { if oraclematcher.MatchMayChangeInTheFuture(matcher, actual) { return true } } return false // none of were going to change } }
func (assertion *AsyncAssertion) matcherMayChange(matcher types.GomegaMatcher, value interface{}) bool { if assertion.actualInputIsAFunction() { return true } return oraclematcher.MatchMayChangeInTheFuture(matcher, value) }
func (m *WithTransformMatcher) MatchMayChangeInTheFuture(_ interface{}) bool { // TODO: Maybe this should always just return true? (Only an issue for non-deterministic transformers.) // // Querying the next matcher is fine if the transformer always will return the same value. // But if the transformer is non-deterministic and returns a different value each time, then there // is no point in querying the next matcher, since it can only comment on the last transformed value. return oraclematcher.MatchMayChangeInTheFuture(m.Matcher, m.transformedValue) }
func (m *NotMatcher) MatchMayChangeInTheFuture(actual interface{}) bool { return oraclematcher.MatchMayChangeInTheFuture(m.Matcher, actual) // just return m.Matcher's value }