aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/onsi/gomega/gstruct/ignore.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/onsi/gomega/gstruct/ignore.go')
-rw-r--r--vendor/github.com/onsi/gomega/gstruct/ignore.go37
1 files changed, 37 insertions, 0 deletions
diff --git a/vendor/github.com/onsi/gomega/gstruct/ignore.go b/vendor/github.com/onsi/gomega/gstruct/ignore.go
new file mode 100644
index 0000000..0365f32
--- /dev/null
+++ b/vendor/github.com/onsi/gomega/gstruct/ignore.go
@@ -0,0 +1,37 @@
+package gstruct
+
+import (
+ "github.com/onsi/gomega/types"
+)
+
+//Ignore ignores the actual value and always succeeds.
+// Expect(nil).To(Ignore())
+// Expect(true).To(Ignore())
+func Ignore() types.GomegaMatcher {
+ return &IgnoreMatcher{true}
+}
+
+//Reject ignores the actual value and always fails. It can be used in conjunction with IgnoreMissing
+//to catch problematic elements, or to verify tests are running.
+// Expect(nil).NotTo(Reject())
+// Expect(true).NotTo(Reject())
+func Reject() types.GomegaMatcher {
+ return &IgnoreMatcher{false}
+}
+
+// A matcher that either always succeeds or always fails.
+type IgnoreMatcher struct {
+ Succeed bool
+}
+
+func (m *IgnoreMatcher) Match(actual interface{}) (bool, error) {
+ return m.Succeed, nil
+}
+
+func (m *IgnoreMatcher) FailureMessage(_ interface{}) (message string) {
+ return "Unconditional failure"
+}
+
+func (m *IgnoreMatcher) NegatedFailureMessage(_ interface{}) (message string) {
+ return "Unconditional success"
+}