arnaucube
arnaucube/mirror-to-giteaPublic Self-hosted repository
mirror-to-gitea/vendor/github.com/onsi/gomega/matchers/not.go
vendor/github.com/onsi/gomega/matchers/not.goRaw
 1package 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}