Path: blob/main/vendor/github.com/onsi/gomega/matchers/have_occurred_matcher.go
2880 views
// untested sections: 212package matchers34import (5"fmt"67"github.com/onsi/gomega/format"8)910type HaveOccurredMatcher struct {11}1213func (matcher *HaveOccurredMatcher) Match(actual any) (success bool, err error) {14// is purely nil?15if actual == nil {16return false, nil17}1819// must be an 'error' type20if !isError(actual) {21return false, fmt.Errorf("Expected an error-type. Got:\n%s", format.Object(actual, 1))22}2324// must be non-nil (or a pointer to a non-nil)25return !isNil(actual), nil26}2728func (matcher *HaveOccurredMatcher) FailureMessage(actual any) (message string) {29return fmt.Sprintf("Expected an error to have occurred. Got:\n%s", format.Object(actual, 1))30}3132func (matcher *HaveOccurredMatcher) NegatedFailureMessage(actual any) (message string) {33return fmt.Sprintf("Unexpected error:\n%s\n%s", format.Object(actual, 1), "occurred")34}353637