6 "github.com/onsi/gomega/format"
9 type HaveCapMatcher struct {
13 func (matcher *HaveCapMatcher) Match(actual interface{}) (success bool, err error) {
14 length, ok := capOf(actual)
16 return false, fmt.Errorf("HaveCap matcher expects a array/channel/slice. Got:\n%s", format.Object(actual, 1))
19 return length == matcher.Count, nil
22 func (matcher *HaveCapMatcher) FailureMessage(actual interface{}) (message string) {
23 return fmt.Sprintf("Expected\n%s\nto have capacity %d", format.Object(actual, 1), matcher.Count)
26 func (matcher *HaveCapMatcher) NegatedFailureMessage(actual interface{}) (message string) {
27 return fmt.Sprintf("Expected\n%s\nnot to have capacity %d", format.Object(actual, 1), matcher.Count)