aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/onsi/gomega/matchers/or.go
diff options
context:
space:
mode:
authorOndrej Fabry <ofabry@cisco.com>2019-08-02 15:07:53 +0200
committerOndrej Fabry <ofabry@cisco.com>2019-08-02 15:07:53 +0200
commitca6003af1a7e1adb7d45879c2d5038bc05c2bb1a (patch)
tree97a3620b0fc5c7a0ee032fe7d12d37b6303cfb01 /vendor/github.com/onsi/gomega/matchers/or.go
parent639870b5083a1e66f4584ec7a5f30492fcdb7168 (diff)
Migrate to modules, refactor Makefile and use Travis for CI
- migrate to Go modules and remove vendor - refactor Makefile - add version package and store version - split extras from the rest - use travis for CI Change-Id: I81b35220653b0f7c9a0fcdd4c527d691ec1e96c1 Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
Diffstat (limited to 'vendor/github.com/onsi/gomega/matchers/or.go')
-rw-r--r--vendor/github.com/onsi/gomega/matchers/or.go67
1 files changed, 0 insertions, 67 deletions
diff --git a/vendor/github.com/onsi/gomega/matchers/or.go b/vendor/github.com/onsi/gomega/matchers/or.go
deleted file mode 100644
index 3bf7998..0000000
--- a/vendor/github.com/onsi/gomega/matchers/or.go
+++ /dev/null
@@ -1,67 +0,0 @@
-package matchers
-
-import (
- "fmt"
-
- "github.com/onsi/gomega/format"
- "github.com/onsi/gomega/internal/oraclematcher"
- "github.com/onsi/gomega/types"
-)
-
-type OrMatcher struct {
- Matchers []types.GomegaMatcher
-
- // state
- firstSuccessfulMatcher types.GomegaMatcher
-}
-
-func (m *OrMatcher) Match(actual interface{}) (success bool, err error) {
- m.firstSuccessfulMatcher = nil
- for _, matcher := range m.Matchers {
- success, err := matcher.Match(actual)
- if err != nil {
- return false, err
- }
- if success {
- m.firstSuccessfulMatcher = matcher
- return true, nil
- }
- }
- return false, nil
-}
-
-func (m *OrMatcher) FailureMessage(actual interface{}) (message string) {
- // not the most beautiful list of matchers, but not bad either...
- return format.Message(actual, fmt.Sprintf("To satisfy at least one of these matchers: %s", m.Matchers))
-}
-
-func (m *OrMatcher) NegatedFailureMessage(actual interface{}) (message string) {
- return m.firstSuccessfulMatcher.NegatedFailureMessage(actual)
-}
-
-func (m *OrMatcher) MatchMayChangeInTheFuture(actual interface{}) bool {
- /*
- Example with 3 matchers: A, B, C
-
- Match evaluates them: F, T, <?> => T
- So match is currently T, what should MatchMayChangeInTheFuture() return?
- Seems like it only depends on B, since currently B MUST change to allow the result to become F
-
- Match eval: F, F, F => F
- So match is currently F, what should MatchMayChangeInTheFuture() return?
- Seems to depend on ANY of them being able to change to T.
- */
-
- if m.firstSuccessfulMatcher != nil {
- // one of the matchers succeeded.. it must be able to change in order to affect the result
- return oraclematcher.MatchMayChangeInTheFuture(m.firstSuccessfulMatcher, actual)
- } else {
- // so all matchers failed.. Any one of them changing would change the result.
- for _, matcher := range m.Matchers {
- if oraclematcher.MatchMayChangeInTheFuture(matcher, actual) {
- return true
- }
- }
- return false // none of were going to change
- }
-}
96'>96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197