forked from cli/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathextension_mock.go
More file actions
246 lines (224 loc) · 6.22 KB
/
extension_mock.go
File metadata and controls
246 lines (224 loc) · 6.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
// Code generated by moq; DO NOT EDIT.
// github.com/matryer/moq
package extensions
import (
"sync"
)
// Ensure, that ExtensionMock does implement Extension.
// If this is not the case, regenerate this file with moq.
var _ Extension = &ExtensionMock{}
// ExtensionMock is a mock implementation of Extension.
//
// func TestSomethingThatUsesExtension(t *testing.T) {
//
// // make and configure a mocked Extension
// mockedExtension := &ExtensionMock{
// IsBinaryFunc: func() bool {
// panic("mock out the IsBinary method")
// },
// IsLocalFunc: func() bool {
// panic("mock out the IsLocal method")
// },
// NameFunc: func() string {
// panic("mock out the Name method")
// },
// PathFunc: func() string {
// panic("mock out the Path method")
// },
// URLFunc: func() string {
// panic("mock out the URL method")
// },
// UpdateAvailableFunc: func() bool {
// panic("mock out the UpdateAvailable method")
// },
// }
//
// // use mockedExtension in code that requires Extension
// // and then make assertions.
//
// }
type ExtensionMock struct {
// IsBinaryFunc mocks the IsBinary method.
IsBinaryFunc func() bool
// IsLocalFunc mocks the IsLocal method.
IsLocalFunc func() bool
// NameFunc mocks the Name method.
NameFunc func() string
// PathFunc mocks the Path method.
PathFunc func() string
// URLFunc mocks the URL method.
URLFunc func() string
// UpdateAvailableFunc mocks the UpdateAvailable method.
UpdateAvailableFunc func() bool
// calls tracks calls to the methods.
calls struct {
// IsBinary holds details about calls to the IsBinary method.
IsBinary []struct {
}
// IsLocal holds details about calls to the IsLocal method.
IsLocal []struct {
}
// Name holds details about calls to the Name method.
Name []struct {
}
// Path holds details about calls to the Path method.
Path []struct {
}
// URL holds details about calls to the URL method.
URL []struct {
}
// UpdateAvailable holds details about calls to the UpdateAvailable method.
UpdateAvailable []struct {
}
}
lockIsBinary sync.RWMutex
lockIsLocal sync.RWMutex
lockName sync.RWMutex
lockPath sync.RWMutex
lockURL sync.RWMutex
lockUpdateAvailable sync.RWMutex
}
// IsBinary calls IsBinaryFunc.
func (mock *ExtensionMock) IsBinary() bool {
if mock.IsBinaryFunc == nil {
panic("ExtensionMock.IsBinaryFunc: method is nil but Extension.IsBinary was just called")
}
callInfo := struct {
}{}
mock.lockIsBinary.Lock()
mock.calls.IsBinary = append(mock.calls.IsBinary, callInfo)
mock.lockIsBinary.Unlock()
return mock.IsBinaryFunc()
}
// IsBinaryCalls gets all the calls that were made to IsBinary.
// Check the length with:
// len(mockedExtension.IsBinaryCalls())
func (mock *ExtensionMock) IsBinaryCalls() []struct {
} {
var calls []struct {
}
mock.lockIsBinary.RLock()
calls = mock.calls.IsBinary
mock.lockIsBinary.RUnlock()
return calls
}
// IsLocal calls IsLocalFunc.
func (mock *ExtensionMock) IsLocal() bool {
if mock.IsLocalFunc == nil {
panic("ExtensionMock.IsLocalFunc: method is nil but Extension.IsLocal was just called")
}
callInfo := struct {
}{}
mock.lockIsLocal.Lock()
mock.calls.IsLocal = append(mock.calls.IsLocal, callInfo)
mock.lockIsLocal.Unlock()
return mock.IsLocalFunc()
}
// IsLocalCalls gets all the calls that were made to IsLocal.
// Check the length with:
// len(mockedExtension.IsLocalCalls())
func (mock *ExtensionMock) IsLocalCalls() []struct {
} {
var calls []struct {
}
mock.lockIsLocal.RLock()
calls = mock.calls.IsLocal
mock.lockIsLocal.RUnlock()
return calls
}
// Name calls NameFunc.
func (mock *ExtensionMock) Name() string {
if mock.NameFunc == nil {
panic("ExtensionMock.NameFunc: method is nil but Extension.Name was just called")
}
callInfo := struct {
}{}
mock.lockName.Lock()
mock.calls.Name = append(mock.calls.Name, callInfo)
mock.lockName.Unlock()
return mock.NameFunc()
}
// NameCalls gets all the calls that were made to Name.
// Check the length with:
// len(mockedExtension.NameCalls())
func (mock *ExtensionMock) NameCalls() []struct {
} {
var calls []struct {
}
mock.lockName.RLock()
calls = mock.calls.Name
mock.lockName.RUnlock()
return calls
}
// Path calls PathFunc.
func (mock *ExtensionMock) Path() string {
if mock.PathFunc == nil {
panic("ExtensionMock.PathFunc: method is nil but Extension.Path was just called")
}
callInfo := struct {
}{}
mock.lockPath.Lock()
mock.calls.Path = append(mock.calls.Path, callInfo)
mock.lockPath.Unlock()
return mock.PathFunc()
}
// PathCalls gets all the calls that were made to Path.
// Check the length with:
// len(mockedExtension.PathCalls())
func (mock *ExtensionMock) PathCalls() []struct {
} {
var calls []struct {
}
mock.lockPath.RLock()
calls = mock.calls.Path
mock.lockPath.RUnlock()
return calls
}
// URL calls URLFunc.
func (mock *ExtensionMock) URL() string {
if mock.URLFunc == nil {
panic("ExtensionMock.URLFunc: method is nil but Extension.URL was just called")
}
callInfo := struct {
}{}
mock.lockURL.Lock()
mock.calls.URL = append(mock.calls.URL, callInfo)
mock.lockURL.Unlock()
return mock.URLFunc()
}
// URLCalls gets all the calls that were made to URL.
// Check the length with:
// len(mockedExtension.URLCalls())
func (mock *ExtensionMock) URLCalls() []struct {
} {
var calls []struct {
}
mock.lockURL.RLock()
calls = mock.calls.URL
mock.lockURL.RUnlock()
return calls
}
// UpdateAvailable calls UpdateAvailableFunc.
func (mock *ExtensionMock) UpdateAvailable() bool {
if mock.UpdateAvailableFunc == nil {
panic("ExtensionMock.UpdateAvailableFunc: method is nil but Extension.UpdateAvailable was just called")
}
callInfo := struct {
}{}
mock.lockUpdateAvailable.Lock()
mock.calls.UpdateAvailable = append(mock.calls.UpdateAvailable, callInfo)
mock.lockUpdateAvailable.Unlock()
return mock.UpdateAvailableFunc()
}
// UpdateAvailableCalls gets all the calls that were made to UpdateAvailable.
// Check the length with:
// len(mockedExtension.UpdateAvailableCalls())
func (mock *ExtensionMock) UpdateAvailableCalls() []struct {
} {
var calls []struct {
}
mock.lockUpdateAvailable.RLock()
calls = mock.calls.UpdateAvailable
mock.lockUpdateAvailable.RUnlock()
return calls
}