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
354 lines (323 loc) · 9.12 KB
/
extension_mock.go
File metadata and controls
354 lines (323 loc) · 9.12 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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
// 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{
// CurrentVersionFunc: func() string {
// panic("mock out the CurrentVersion method")
// },
// IsBinaryFunc: func() bool {
// panic("mock out the IsBinary method")
// },
// IsLocalFunc: func() bool {
// panic("mock out the IsLocal method")
// },
// IsPinnedFunc: func() bool {
// panic("mock out the IsPinned method")
// },
// NameFunc: func() string {
// panic("mock out the Name method")
// },
// PathFunc: func() string {
// panic("mock out the Path method")
// },
// PinFunc: func() string {
// panic("mock out the Pin 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 {
// CurrentVersionFunc mocks the CurrentVersion method.
CurrentVersionFunc func() string
// IsBinaryFunc mocks the IsBinary method.
IsBinaryFunc func() bool
// IsLocalFunc mocks the IsLocal method.
IsLocalFunc func() bool
// IsPinnedFunc mocks the IsPinned method.
IsPinnedFunc func() bool
// NameFunc mocks the Name method.
NameFunc func() string
// PathFunc mocks the Path method.
PathFunc func() string
// PinFunc mocks the Pin method.
PinFunc 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 {
// CurrentVersion holds details about calls to the CurrentVersion method.
CurrentVersion []struct {
}
// IsBinary holds details about calls to the IsBinary method.
IsBinary []struct {
}
// IsLocal holds details about calls to the IsLocal method.
IsLocal []struct {
}
// IsPinned holds details about calls to the IsPinned method.
IsPinned []struct {
}
// Name holds details about calls to the Name method.
Name []struct {
}
// Path holds details about calls to the Path method.
Path []struct {
}
// Pin holds details about calls to the Pin method.
Pin []struct {
}
// URL holds details about calls to the URL method.
URL []struct {
}
// UpdateAvailable holds details about calls to the UpdateAvailable method.
UpdateAvailable []struct {
}
}
lockCurrentVersion sync.RWMutex
lockIsBinary sync.RWMutex
lockIsLocal sync.RWMutex
lockIsPinned sync.RWMutex
lockName sync.RWMutex
lockPath sync.RWMutex
lockPin sync.RWMutex
lockURL sync.RWMutex
lockUpdateAvailable sync.RWMutex
}
// CurrentVersion calls CurrentVersionFunc.
func (mock *ExtensionMock) CurrentVersion() string {
if mock.CurrentVersionFunc == nil {
panic("ExtensionMock.CurrentVersionFunc: method is nil but Extension.CurrentVersion was just called")
}
callInfo := struct {
}{}
mock.lockCurrentVersion.Lock()
mock.calls.CurrentVersion = append(mock.calls.CurrentVersion, callInfo)
mock.lockCurrentVersion.Unlock()
return mock.CurrentVersionFunc()
}
// CurrentVersionCalls gets all the calls that were made to CurrentVersion.
// Check the length with:
// len(mockedExtension.CurrentVersionCalls())
func (mock *ExtensionMock) CurrentVersionCalls() []struct {
} {
var calls []struct {
}
mock.lockCurrentVersion.RLock()
calls = mock.calls.CurrentVersion
mock.lockCurrentVersion.RUnlock()
return calls
}
// 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
}
// IsPinned calls IsPinnedFunc.
func (mock *ExtensionMock) IsPinned() bool {
if mock.IsPinnedFunc == nil {
panic("ExtensionMock.IsPinnedFunc: method is nil but Extension.IsPinned was just called")
}
callInfo := struct {
}{}
mock.lockIsPinned.Lock()
mock.calls.IsPinned = append(mock.calls.IsPinned, callInfo)
mock.lockIsPinned.Unlock()
return mock.IsPinnedFunc()
}
// IsPinnedCalls gets all the calls that were made to IsPinned.
// Check the length with:
// len(mockedExtension.IsPinnedCalls())
func (mock *ExtensionMock) IsPinnedCalls() []struct {
} {
var calls []struct {
}
mock.lockIsPinned.RLock()
calls = mock.calls.IsPinned
mock.lockIsPinned.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
}
// Pin calls PinFunc.
func (mock *ExtensionMock) Pin() string {
if mock.PinFunc == nil {
panic("ExtensionMock.PinFunc: method is nil but Extension.Pin was just called")
}
callInfo := struct {
}{}
mock.lockPin.Lock()
mock.calls.Pin = append(mock.calls.Pin, callInfo)
mock.lockPin.Unlock()
return mock.PinFunc()
}
// PinCalls gets all the calls that were made to Pin.
// Check the length with:
// len(mockedExtension.PinCalls())
func (mock *ExtensionMock) PinCalls() []struct {
} {
var calls []struct {
}
mock.lockPin.RLock()
calls = mock.calls.Pin
mock.lockPin.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
}