123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- package oglematchers
- func Error(m Matcher) Matcher {
- return &errorMatcher{m}
- }
- type errorMatcher struct {
- wrappedMatcher Matcher
- }
- func (m *errorMatcher) Description() string {
- return "error " + m.wrappedMatcher.Description()
- }
- func (m *errorMatcher) Matches(c interface{}) error {
-
- e, ok := c.(error)
- if !ok {
- return NewFatalError("which is not an error")
- }
-
- return m.wrappedMatcher.Matches(e.Error())
- }
|