Documentation
¶
Index ¶
- type FSMock
- func (mock *FSMock) Chtimes(path string, aTime time.Time, mTime time.Time) error
- func (mock *FSMock) ChtimesCalls() []struct{ ... }
- func (mock *FSMock) DirectoryExists(path string) bool
- func (mock *FSMock) DirectoryExistsCalls() []struct{ ... }
- func (mock *FSMock) FileExists(path string) bool
- func (mock *FSMock) FileExistsCalls() []struct{ ... }
- func (mock *FSMock) GetAccessibleEntries(path string) vfs.Entries
- func (mock *FSMock) GetAccessibleEntriesCalls() []struct{ ... }
- func (mock *FSMock) ReadFile(path string) (string, bool)
- func (mock *FSMock) ReadFileCalls() []struct{ ... }
- func (mock *FSMock) Realpath(path string) string
- func (mock *FSMock) RealpathCalls() []struct{ ... }
- func (mock *FSMock) Remove(path string) error
- func (mock *FSMock) RemoveCalls() []struct{ ... }
- func (mock *FSMock) Stat(path string) vfs.FileInfo
- func (mock *FSMock) StatCalls() []struct{ ... }
- func (mock *FSMock) UseCaseSensitiveFileNames() bool
- func (mock *FSMock) UseCaseSensitiveFileNamesCalls() []struct{}
- func (mock *FSMock) WalkDir(root string, walkFn vfs.WalkDirFunc) error
- func (mock *FSMock) WalkDirCalls() []struct{ ... }
- func (mock *FSMock) WriteFile(path string, data string, writeByteOrderMark bool) error
- func (mock *FSMock) WriteFileCalls() []struct{ ... }
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FSMock ¶
type FSMock struct {
// ChtimesFunc mocks the Chtimes method.
ChtimesFunc func(path string, aTime time.Time, mTime time.Time) error
// DirectoryExistsFunc mocks the DirectoryExists method.
DirectoryExistsFunc func(path string) bool
// FileExistsFunc mocks the FileExists method.
FileExistsFunc func(path string) bool
// GetAccessibleEntriesFunc mocks the GetAccessibleEntries method.
GetAccessibleEntriesFunc func(path string) vfs.Entries
// ReadFileFunc mocks the ReadFile method.
ReadFileFunc func(path string) (string, bool)
// RealpathFunc mocks the Realpath method.
RealpathFunc func(path string) string
// RemoveFunc mocks the Remove method.
RemoveFunc func(path string) error
// StatFunc mocks the Stat method.
StatFunc func(path string) vfs.FileInfo
// UseCaseSensitiveFileNamesFunc mocks the UseCaseSensitiveFileNames method.
UseCaseSensitiveFileNamesFunc func() bool
// WalkDirFunc mocks the WalkDir method.
WalkDirFunc func(root string, walkFn vfs.WalkDirFunc) error
// WriteFileFunc mocks the WriteFile method.
WriteFileFunc func(path string, data string, writeByteOrderMark bool) error
// contains filtered or unexported fields
}
FSMock is a mock implementation of vfs.FS.
func TestSomethingThatUsesFS(t *testing.T) {
// make and configure a mocked vfs.FS
mockedFS := &FSMock{
ChtimesFunc: func(path string, aTime time.Time, mTime time.Time) error {
panic("mock out the Chtimes method")
},
DirectoryExistsFunc: func(path string) bool {
panic("mock out the DirectoryExists method")
},
FileExistsFunc: func(path string) bool {
panic("mock out the FileExists method")
},
GetAccessibleEntriesFunc: func(path string) vfs.Entries {
panic("mock out the GetAccessibleEntries method")
},
ReadFileFunc: func(path string) (string, bool) {
panic("mock out the ReadFile method")
},
RealpathFunc: func(path string) string {
panic("mock out the Realpath method")
},
RemoveFunc: func(path string) error {
panic("mock out the Remove method")
},
StatFunc: func(path string) vfs.FileInfo {
panic("mock out the Stat method")
},
UseCaseSensitiveFileNamesFunc: func() bool {
panic("mock out the UseCaseSensitiveFileNames method")
},
WalkDirFunc: func(root string, walkFn vfs.WalkDirFunc) error {
panic("mock out the WalkDir method")
},
WriteFileFunc: func(path string, data string, writeByteOrderMark bool) error {
panic("mock out the WriteFile method")
},
}
// use mockedFS in code that requires vfs.FS
// and then make assertions.
}
func (*FSMock) ChtimesCalls ¶
ChtimesCalls gets all the calls that were made to Chtimes. Check the length with:
len(mockedFS.ChtimesCalls())
func (*FSMock) DirectoryExists ¶
DirectoryExists calls DirectoryExistsFunc.
func (*FSMock) DirectoryExistsCalls ¶
DirectoryExistsCalls gets all the calls that were made to DirectoryExists. Check the length with:
len(mockedFS.DirectoryExistsCalls())
func (*FSMock) FileExists ¶
FileExists calls FileExistsFunc.
func (*FSMock) FileExistsCalls ¶
FileExistsCalls gets all the calls that were made to FileExists. Check the length with:
len(mockedFS.FileExistsCalls())
func (*FSMock) GetAccessibleEntries ¶
GetAccessibleEntries calls GetAccessibleEntriesFunc.
func (*FSMock) GetAccessibleEntriesCalls ¶
GetAccessibleEntriesCalls gets all the calls that were made to GetAccessibleEntries. Check the length with:
len(mockedFS.GetAccessibleEntriesCalls())
func (*FSMock) ReadFileCalls ¶
ReadFileCalls gets all the calls that were made to ReadFile. Check the length with:
len(mockedFS.ReadFileCalls())
func (*FSMock) RealpathCalls ¶
RealpathCalls gets all the calls that were made to Realpath. Check the length with:
len(mockedFS.RealpathCalls())
func (*FSMock) RemoveCalls ¶
RemoveCalls gets all the calls that were made to Remove. Check the length with:
len(mockedFS.RemoveCalls())
func (*FSMock) StatCalls ¶
StatCalls gets all the calls that were made to Stat. Check the length with:
len(mockedFS.StatCalls())
func (*FSMock) UseCaseSensitiveFileNames ¶
UseCaseSensitiveFileNames calls UseCaseSensitiveFileNamesFunc.
func (*FSMock) UseCaseSensitiveFileNamesCalls ¶
func (mock *FSMock) UseCaseSensitiveFileNamesCalls() []struct{}
UseCaseSensitiveFileNamesCalls gets all the calls that were made to UseCaseSensitiveFileNames. Check the length with:
len(mockedFS.UseCaseSensitiveFileNamesCalls())
func (*FSMock) WalkDir ¶
func (mock *FSMock) WalkDir(root string, walkFn vfs.WalkDirFunc) error
WalkDir calls WalkDirFunc.
func (*FSMock) WalkDirCalls ¶
func (mock *FSMock) WalkDirCalls() []struct { Root string WalkFn vfs.WalkDirFunc }
WalkDirCalls gets all the calls that were made to WalkDir. Check the length with:
len(mockedFS.WalkDirCalls())