blob: 2c91670bd9bbc6191fc9754a15f6d76e7902f9fe [file] [log] [blame]
Matthias Andreas Benkard832a54e2019-01-29 09:27:38 +01001package matchers
2
3import (
4 "github.com/onsi/gomega/internal/oraclematcher"
5 "github.com/onsi/gomega/types"
6)
7
8type NotMatcher struct {
9 Matcher types.GomegaMatcher
10}
11
12func (m *NotMatcher) Match(actual interface{}) (bool, error) {
13 success, err := m.Matcher.Match(actual)
14 if err != nil {
15 return false, err
16 }
17 return !success, nil
18}
19
20func (m *NotMatcher) FailureMessage(actual interface{}) (message string) {
21 return m.Matcher.NegatedFailureMessage(actual) // works beautifully
22}
23
24func (m *NotMatcher) NegatedFailureMessage(actual interface{}) (message string) {
25 return m.Matcher.FailureMessage(actual) // works beautifully
26}
27
28func (m *NotMatcher) MatchMayChangeInTheFuture(actual interface{}) bool {
29 return oraclematcher.MatchMayChangeInTheFuture(m.Matcher, actual) // just return m.Matcher's value
30}