6 "github.com/onsi/gomega/format"
9 type HaveOccurredMatcher struct {
12 func (matcher *HaveOccurredMatcher) Match(actual interface{}) (success bool, err error) {
18 // must be an 'error' type
20 return false, fmt.Errorf("Expected an error-type. Got:\n%s", format.Object(actual, 1))
23 // must be non-nil (or a pointer to a non-nil)
24 return !isNil(actual), nil
27 func (matcher *HaveOccurredMatcher) FailureMessage(actual interface{}) (message string) {
28 return fmt.Sprintf("Expected an error to have occurred. Got:\n%s", format.Object(actual, 1))
31 func (matcher *HaveOccurredMatcher) NegatedFailureMessage(actual interface{}) (message string) {
32 return fmt.Sprintf("Expected error:\n%s\n%s\n%s", format.Object(actual, 1), format.IndentString(actual.(error).Error(), 1), "not to have occurred")