Debian Codegraph @

matchers/not.go

raw symbols SCIP
1 package matchersscip-go gomod github.com/poy/onpar . `github.com/poy/onpar/matchers`/
2
3 import "fmtscip-go gomod github.com/golang/go/src go1.21.4 fmt/"
4
5 // Matcher is a type that matches expected against actuals.
6 type Matcherscip-go gomod github.com/poy/onpar . `github.com/poy/onpar/matchers`/Matcher# interface {
7 Matchscip-go gomod github.com/poy/onpar . `github.com/poy/onpar/matchers`/Matcher#Match.(actual any) (resultValue any, err error)
8 }
9
10 // NotMatcher accepts a matcher and will succeed if the specified matcher fails.
11 type NotMatcherscip-go gomod github.com/poy/onpar . `github.com/poy/onpar/matchers`/NotMatcher# struct {
12 childscip-go gomod github.com/poy/onpar . `github.com/poy/onpar/matchers`/NotMatcher#child. Matcherscip-go gomod github.com/poy/onpar . `github.com/poy/onpar/matchers`/Matcher#
13 }
14
15 // Not returns a NotMatcher with the specified child matcher.
16 func Notscip-go gomod github.com/poy/onpar . `github.com/poy/onpar/matchers`/Not().(child Matcherscip-go gomod github.com/poy/onpar . `github.com/poy/onpar/matchers`/Matcher#) NotMatcherscip-go gomod github.com/poy/onpar . `github.com/poy/onpar/matchers`/NotMatcher# {
17 return NotMatcherscip-go gomod github.com/poy/onpar . `github.com/poy/onpar/matchers`/NotMatcher#{
18 childscip-go gomod github.com/poy/onpar . `github.com/poy/onpar/matchers`/NotMatcher#child.: child,
19 }
20 }
21
22 func (m NotMatcherscip-go gomod github.com/poy/onpar . `github.com/poy/onpar/matchers`/NotMatcher#) Matchscip-go gomod github.com/poy/onpar . `github.com/poy/onpar/matchers`/NotMatcher#Match().(actual any) (any, error) {
23 v, err := m.childscip-go gomod github.com/poy/onpar . `github.com/poy/onpar/matchers`/NotMatcher#child..Matchscip-go gomod github.com/poy/onpar . `github.com/poy/onpar/matchers`/Matcher#Match.(actual)
24 if err == nil {
25 return nil, fmtscip-go gomod github.com/golang/go/src go1.21.4 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.21.4 fmt/Errorf().("%+v (%[1]T) was expected to fail matcher %#v", actual, m.childscip-go gomod github.com/poy/onpar . `github.com/poy/onpar/matchers`/NotMatcher#child.)
26 }
27
28 return v, nil
29 }