initial commit
[govpp.git] / vendor / github.com / onsi / gomega / gstruct / ignore.go
1 package gstruct
2
3 import (
4         "github.com/onsi/gomega/types"
5 )
6
7 //Ignore ignores the actual value and always succeeds.
8 //  Expect(nil).To(Ignore())
9 //  Expect(true).To(Ignore())
10 func Ignore() types.GomegaMatcher {
11         return &IgnoreMatcher{true}
12 }
13
14 //Reject ignores the actual value and always fails. It can be used in conjunction with IgnoreMissing
15 //to catch problematic elements, or to verify tests are running.
16 //  Expect(nil).NotTo(Reject())
17 //  Expect(true).NotTo(Reject())
18 func Reject() types.GomegaMatcher {
19         return &IgnoreMatcher{false}
20 }
21
22 // A matcher that either always succeeds or always fails.
23 type IgnoreMatcher struct {
24         Succeed bool
25 }
26
27 func (m *IgnoreMatcher) Match(actual interface{}) (bool, error) {
28         return m.Succeed, nil
29 }
30
31 func (m *IgnoreMatcher) FailureMessage(_ interface{}) (message string) {
32         return "Unconditional failure"
33 }
34
35 func (m *IgnoreMatcher) NegatedFailureMessage(_ interface{}) (message string) {
36         return "Unconditional success"
37 }