...

Source file src/github.com/onsi/gomega/matchers/not.go

Documentation: github.com/onsi/gomega/matchers

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

View as plain text