MCPcopy
hub / github.com/cli/cli / SearcherMock

Struct SearcherMock

pkg/search/searcher_mock.go:41–90  ·  view source on GitHub ↗

SearcherMock is a mock implementation of Searcher. func TestSomethingThatUsesSearcher(t *testing.T) { // make and configure a mocked Searcher mockedSearcher := &SearcherMock{ CodeFunc: func(query Query) (CodeResult, error) { panic("mock out the Code method") }, CommitsFunc: func(

Source from the content-addressed store, hash-verified

39//
40// }
41type SearcherMock struct {
42 // CodeFunc mocks the Code method.
43 CodeFunc func(query Query) (CodeResult, error)
44
45 // CommitsFunc mocks the Commits method.
46 CommitsFunc func(query Query) (CommitsResult, error)
47
48 // IssuesFunc mocks the Issues method.
49 IssuesFunc func(query Query) (IssuesResult, error)
50
51 // RepositoriesFunc mocks the Repositories method.
52 RepositoriesFunc func(query Query) (RepositoriesResult, error)
53
54 // URLFunc mocks the URL method.
55 URLFunc func(query Query) string
56
57 // calls tracks calls to the methods.
58 calls struct {
59 // Code holds details about calls to the Code method.
60 Code []struct {
61 // Query is the query argument value.
62 Query Query
63 }
64 // Commits holds details about calls to the Commits method.
65 Commits []struct {
66 // Query is the query argument value.
67 Query Query
68 }
69 // Issues holds details about calls to the Issues method.
70 Issues []struct {
71 // Query is the query argument value.
72 Query Query
73 }
74 // Repositories holds details about calls to the Repositories method.
75 Repositories []struct {
76 // Query is the query argument value.
77 Query Query
78 }
79 // URL holds details about calls to the URL method.
80 URL []struct {
81 // Query is the query argument value.
82 Query Query
83 }
84 }
85 lockCode sync.RWMutex
86 lockCommits sync.RWMutex
87 lockIssues sync.RWMutex
88 lockRepositories sync.RWMutex
89 lockURL sync.RWMutex
90}
91
92// Code calls CodeFunc.
93func (mock *SearcherMock) Code(query Query) (CodeResult, error) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected