| 1 | package matchers_testscip-go gomod github.com/poy/onpar . `github.com/poy/onpar/matchers_test`/ |
| 2 | |
| 3 | import ( |
| 4 | "testingscip-go gomod github.com/golang/go/src go1.21.4 testing/" |
| 5 | |
| 6 | "github.com/poy/onpar/matchersscip-go gomod github.com/poy/onpar . `github.com/poy/onpar/matchers`/" |
| 7 | ) |
| 8 | |
| 9 | func TestHaveKeyscip-go gomod github.com/poy/onpar . `github.com/poy/onpar/matchers_test`/TestHaveKey().(t *testingscip-go gomod github.com/golang/go/src go1.21.4 testing/.Tscip-go gomod github.com/golang/go/src go1.21.4 testing/T#) { |
| 10 | m := matchersscip-go gomod github.com/poy/onpar . `github.com/poy/onpar/matchers`/.HaveKeyscip-go gomod github.com/poy/onpar . `github.com/poy/onpar/matchers`/HaveKey().(99) |
| 11 | |
| 12 | _, err := m.Matchscip-go gomod github.com/poy/onpar . `github.com/poy/onpar/matchers`/HaveKeyMatcher#Match().(map[int]string{1: "a"}) |
| 13 | if err == nil { |
| 14 | t.Errorscip-go gomod github.com/golang/go/src go1.21.4 testing/common#Error().("expected err to not be nil") |
| 15 | } |
| 16 | |
| 17 | v, err := m.Matchscip-go gomod github.com/poy/onpar . `github.com/poy/onpar/matchers`/HaveKeyMatcher#Match().(map[int]string{99: "a"}) |
| 18 | if err != nil { |
| 19 | t.Fatalscip-go gomod github.com/golang/go/src go1.21.4 testing/common#Fatal().("expected err to be nil") |
| 20 | } |
| 21 | |
| 22 | if v != "a" { |
| 23 | t.Errorfscip-go gomod github.com/golang/go/src go1.21.4 testing/common#Errorf().("expected %v to equal %v", v, "a") |
| 24 | } |
| 25 | |
| 26 | _, err = m.Matchscip-go gomod github.com/poy/onpar . `github.com/poy/onpar/matchers`/HaveKeyMatcher#Match().(map[string]string{"foo": "a"}) |
| 27 | if err == nil { |
| 28 | t.Errorscip-go gomod github.com/golang/go/src go1.21.4 testing/common#Error().("expected err to not be nil") |
| 29 | } |
| 30 | |
| 31 | _, err = m.Matchscip-go gomod github.com/poy/onpar . `github.com/poy/onpar/matchers`/HaveKeyMatcher#Match().(101) |
| 32 | if err == nil { |
| 33 | t.Errorscip-go gomod github.com/golang/go/src go1.21.4 testing/common#Error().("expected err to not be nil") |
| 34 | } |
| 35 | } |