-
Notifications
You must be signed in to change notification settings - Fork 0
/
dir_entry_mock.go
179 lines (163 loc) · 4.07 KB
/
dir_entry_mock.go
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
// Code generated by moq; DO NOT EDIT.
// github.com/matryer/moq
package xfs
import (
"io/fs"
"sync"
)
// Ensure, that DirEntryMock does implement DirEntry.
// If this is not the case, regenerate this file with moq.
var _ DirEntry = &DirEntryMock{}
// DirEntryMock is a mock implementation of DirEntry.
//
// func TestSomethingThatUsesDirEntry(t *testing.T) {
//
// // make and configure a mocked DirEntry
// mockedDirEntry := &DirEntryMock{
// InfoFunc: func() (fs.FileInfo, error) {
// panic("mock out the Info method")
// },
// IsDirFunc: func() bool {
// panic("mock out the IsDir method")
// },
// NameFunc: func() string {
// panic("mock out the Name method")
// },
// TypeFunc: func() fs.FileMode {
// panic("mock out the Type method")
// },
// }
//
// // use mockedDirEntry in code that requires DirEntry
// // and then make assertions.
//
// }
type DirEntryMock struct {
// InfoFunc mocks the Info method.
InfoFunc func() (fs.FileInfo, error)
// IsDirFunc mocks the IsDir method.
IsDirFunc func() bool
// NameFunc mocks the Name method.
NameFunc func() string
// TypeFunc mocks the Type method.
TypeFunc func() fs.FileMode
// calls tracks calls to the methods.
calls struct {
// Info holds details about calls to the Info method.
Info []struct {
}
// IsDir holds details about calls to the IsDir method.
IsDir []struct {
}
// Name holds details about calls to the Name method.
Name []struct {
}
// Type holds details about calls to the Type method.
Type []struct {
}
}
lockInfo sync.RWMutex
lockIsDir sync.RWMutex
lockName sync.RWMutex
lockType sync.RWMutex
}
// Info calls InfoFunc.
func (mock *DirEntryMock) Info() (fs.FileInfo, error) {
if mock.InfoFunc == nil {
panic("DirEntryMock.InfoFunc: method is nil but DirEntry.Info was just called")
}
callInfo := struct {
}{}
mock.lockInfo.Lock()
mock.calls.Info = append(mock.calls.Info, callInfo)
mock.lockInfo.Unlock()
return mock.InfoFunc()
}
// InfoCalls gets all the calls that were made to Info.
// Check the length with:
//
// len(mockedDirEntry.InfoCalls())
func (mock *DirEntryMock) InfoCalls() []struct {
} {
var calls []struct {
}
mock.lockInfo.RLock()
calls = mock.calls.Info
mock.lockInfo.RUnlock()
return calls
}
// IsDir calls IsDirFunc.
func (mock *DirEntryMock) IsDir() bool {
if mock.IsDirFunc == nil {
panic("DirEntryMock.IsDirFunc: method is nil but DirEntry.IsDir was just called")
}
callInfo := struct {
}{}
mock.lockIsDir.Lock()
mock.calls.IsDir = append(mock.calls.IsDir, callInfo)
mock.lockIsDir.Unlock()
return mock.IsDirFunc()
}
// IsDirCalls gets all the calls that were made to IsDir.
// Check the length with:
//
// len(mockedDirEntry.IsDirCalls())
func (mock *DirEntryMock) IsDirCalls() []struct {
} {
var calls []struct {
}
mock.lockIsDir.RLock()
calls = mock.calls.IsDir
mock.lockIsDir.RUnlock()
return calls
}
// Name calls NameFunc.
func (mock *DirEntryMock) Name() string {
if mock.NameFunc == nil {
panic("DirEntryMock.NameFunc: method is nil but DirEntry.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(mockedDirEntry.NameCalls())
func (mock *DirEntryMock) NameCalls() []struct {
} {
var calls []struct {
}
mock.lockName.RLock()
calls = mock.calls.Name
mock.lockName.RUnlock()
return calls
}
// Type calls TypeFunc.
func (mock *DirEntryMock) Type() fs.FileMode {
if mock.TypeFunc == nil {
panic("DirEntryMock.TypeFunc: method is nil but DirEntry.Type was just called")
}
callInfo := struct {
}{}
mock.lockType.Lock()
mock.calls.Type = append(mock.calls.Type, callInfo)
mock.lockType.Unlock()
return mock.TypeFunc()
}
// TypeCalls gets all the calls that were made to Type.
// Check the length with:
//
// len(mockedDirEntry.TypeCalls())
func (mock *DirEntryMock) TypeCalls() []struct {
} {
var calls []struct {
}
mock.lockType.RLock()
calls = mock.calls.Type
mock.lockType.RUnlock()
return calls
}