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