diff options
author | Ondrej Fabry <ofabry@cisco.com> | 2019-08-02 15:07:53 +0200 |
---|---|---|
committer | Ondrej Fabry <ofabry@cisco.com> | 2019-08-02 15:07:53 +0200 |
commit | ca6003af1a7e1adb7d45879c2d5038bc05c2bb1a (patch) | |
tree | 97a3620b0fc5c7a0ee032fe7d12d37b6303cfb01 /vendor/github.com/onsi/gomega/matchers/match_error_matcher.go | |
parent | 639870b5083a1e66f4584ec7a5f30492fcdb7168 (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/match_error_matcher.go')
-rw-r--r-- | vendor/github.com/onsi/gomega/matchers/match_error_matcher.go | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/vendor/github.com/onsi/gomega/matchers/match_error_matcher.go b/vendor/github.com/onsi/gomega/matchers/match_error_matcher.go deleted file mode 100644 index 03cdf04..0000000 --- a/vendor/github.com/onsi/gomega/matchers/match_error_matcher.go +++ /dev/null @@ -1,50 +0,0 @@ -package matchers - -import ( - "fmt" - "github.com/onsi/gomega/format" - "reflect" -) - -type MatchErrorMatcher struct { - Expected interface{} -} - -func (matcher *MatchErrorMatcher) Match(actual interface{}) (success bool, err error) { - if isNil(actual) { - return false, fmt.Errorf("Expected an error, got nil") - } - - if !isError(actual) { - return false, fmt.Errorf("Expected an error. Got:\n%s", format.Object(actual, 1)) - } - - actualErr := actual.(error) - - if isString(matcher.Expected) { - return reflect.DeepEqual(actualErr.Error(), matcher.Expected), nil - } - - if isError(matcher.Expected) { - return reflect.DeepEqual(actualErr, matcher.Expected), nil - } - - var subMatcher omegaMatcher - var hasSubMatcher bool - if matcher.Expected != nil { - subMatcher, hasSubMatcher = (matcher.Expected).(omegaMatcher) - if hasSubMatcher { - return subMatcher.Match(actualErr.Error()) - } - } - - return false, fmt.Errorf("MatchError must be passed an error, string, or Matcher that can match on strings. Got:\n%s", format.Object(matcher.Expected, 1)) -} - -func (matcher *MatchErrorMatcher) FailureMessage(actual interface{}) (message string) { - return format.Message(actual, "to match error", matcher.Expected) -} - -func (matcher *MatchErrorMatcher) NegatedFailureMessage(actual interface{}) (message string) { - return format.Message(actual, "not to match error", matcher.Expected) -} |