initial commit
[govpp.git] / vendor / github.com / onsi / gomega / matchers / be_empty_matcher.go
1 package matchers
2
3 import (
4         "fmt"
5         "github.com/onsi/gomega/format"
6 )
7
8 type BeEmptyMatcher struct {
9 }
10
11 func (matcher *BeEmptyMatcher) Match(actual interface{}) (success bool, err error) {
12         length, ok := lengthOf(actual)
13         if !ok {
14                 return false, fmt.Errorf("BeEmpty matcher expects a string/array/map/channel/slice.  Got:\n%s", format.Object(actual, 1))
15         }
16
17         return length == 0, nil
18 }
19
20 func (matcher *BeEmptyMatcher) FailureMessage(actual interface{}) (message string) {
21         return format.Message(actual, "to be empty")
22 }
23
24 func (matcher *BeEmptyMatcher) NegatedFailureMessage(actual interface{}) (message string) {
25         return format.Message(actual, "not to be empty")
26 }