Documentation
¶
Index ¶
- type DirEntry
- type DirEntryMock
- func (mock *DirEntryMock) Info() (fs.FileInfo, error)
- func (mock *DirEntryMock) InfoCalls() []struct{}
- func (mock *DirEntryMock) IsDir() bool
- func (mock *DirEntryMock) IsDirCalls() []struct{}
- func (mock *DirEntryMock) Name() string
- func (mock *DirEntryMock) NameCalls() []struct{}
- func (mock *DirEntryMock) Type() fs.FileMode
- func (mock *DirEntryMock) TypeCalls() []struct{}
- type FS
- type FSMock
- func (mock *FSMock) DirName() string
- func (mock *FSMock) DirNameCalls() []struct{}
- func (mock *FSMock) Open(name string) (fs.File, error)
- func (mock *FSMock) OpenCalls() []struct{ ... }
- func (mock *FSMock) ReadDir(name string) ([]fs.DirEntry, error)
- func (mock *FSMock) ReadDirCalls() []struct{ ... }
- func (mock *FSMock) ReadFile(name string) ([]byte, error)
- func (mock *FSMock) ReadFileCalls() []struct{ ... }
- func (mock *FSMock) Stat(name string) (fs.FileInfo, error)
- func (mock *FSMock) StatCalls() []struct{ ... }
- type File
- type FileInfo
- type FileInfoMock
- func (mock *FileInfoMock) IsDir() bool
- func (mock *FileInfoMock) IsDirCalls() []struct{}
- func (mock *FileInfoMock) ModTime() time.Time
- func (mock *FileInfoMock) ModTimeCalls() []struct{}
- func (mock *FileInfoMock) Mode() fs.FileMode
- func (mock *FileInfoMock) ModeCalls() []struct{}
- func (mock *FileInfoMock) Name() string
- func (mock *FileInfoMock) NameCalls() []struct{}
- func (mock *FileInfoMock) Size() int64
- func (mock *FileInfoMock) SizeCalls() []struct{}
- func (mock *FileInfoMock) Sys() any
- func (mock *FileInfoMock) SysCalls() []struct{}
- type FileMock
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DirEntryMock ¶ added in v0.0.2
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 // contains filtered or unexported fields }
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. }
func (*DirEntryMock) Info ¶ added in v0.0.2
func (mock *DirEntryMock) Info() (fs.FileInfo, error)
Info calls InfoFunc.
func (*DirEntryMock) InfoCalls ¶ added in v0.0.2
func (mock *DirEntryMock) InfoCalls() []struct { }
InfoCalls gets all the calls that were made to Info. Check the length with:
len(mockedDirEntry.InfoCalls())
func (*DirEntryMock) IsDir ¶ added in v0.0.2
func (mock *DirEntryMock) IsDir() bool
IsDir calls IsDirFunc.
func (*DirEntryMock) IsDirCalls ¶ added in v0.0.2
func (mock *DirEntryMock) IsDirCalls() []struct { }
IsDirCalls gets all the calls that were made to IsDir. Check the length with:
len(mockedDirEntry.IsDirCalls())
func (*DirEntryMock) Name ¶ added in v0.0.2
func (mock *DirEntryMock) Name() string
Name calls NameFunc.
func (*DirEntryMock) NameCalls ¶ added in v0.0.2
func (mock *DirEntryMock) NameCalls() []struct { }
NameCalls gets all the calls that were made to Name. Check the length with:
len(mockedDirEntry.NameCalls())
func (*DirEntryMock) Type ¶ added in v0.0.2
func (mock *DirEntryMock) Type() fs.FileMode
Type calls TypeFunc.
func (*DirEntryMock) TypeCalls ¶ added in v0.0.2
func (mock *DirEntryMock) TypeCalls() []struct { }
TypeCalls gets all the calls that were made to Type. Check the length with:
len(mockedDirEntry.TypeCalls())
type FS ¶
type FS interface { // DirName returns the name used to create the rooted xfs.FS DirName() string // contains filtered or unexported methods }
type FSMock ¶
type FSMock struct { // DirNameFunc mocks the DirName method. DirNameFunc func() string // OpenFunc mocks the Open method. OpenFunc func(name string) (fs.File, error) // ReadDirFunc mocks the ReadDir method. ReadDirFunc func(name string) ([]fs.DirEntry, error) // ReadFileFunc mocks the ReadFile method. ReadFileFunc func(name string) ([]byte, error) // StatFunc mocks the Stat method. StatFunc func(name string) (fs.FileInfo, error) // contains filtered or unexported fields }
FSMock is a mock implementation of FS.
func TestSomethingThatUsesFS(t *testing.T) { // make and configure a mocked FS mockedFS := &FSMock{ DirNameFunc: func() string { panic("mock out the DirName method") }, OpenFunc: func(name string) (fs.File, error) { panic("mock out the Open method") }, ReadDirFunc: func(name string) ([]fs.DirEntry, error) { panic("mock out the ReadDir method") }, ReadFileFunc: func(name string) ([]byte, error) { panic("mock out the ReadFile method") }, StatFunc: func(name string) (fs.FileInfo, error) { panic("mock out the Stat method") }, } // use mockedFS in code that requires FS // and then make assertions. }
func (*FSMock) DirNameCalls ¶ added in v0.0.3
func (mock *FSMock) DirNameCalls() []struct { }
DirNameCalls gets all the calls that were made to DirName. Check the length with:
len(mockedFS.DirNameCalls())
func (*FSMock) OpenCalls ¶
OpenCalls gets all the calls that were made to Open. Check the length with:
len(mockedFS.OpenCalls())
func (*FSMock) ReadDirCalls ¶ added in v0.0.2
ReadDirCalls gets all the calls that were made to ReadDir. Check the length with:
len(mockedFS.ReadDirCalls())
func (*FSMock) ReadFileCalls ¶ added in v0.0.2
ReadFileCalls gets all the calls that were made to ReadFile. Check the length with:
len(mockedFS.ReadFileCalls())
type FileInfoMock ¶
type FileInfoMock struct { // IsDirFunc mocks the IsDir method. IsDirFunc func() bool // ModTimeFunc mocks the ModTime method. ModTimeFunc func() time.Time // ModeFunc mocks the Mode method. ModeFunc func() fs.FileMode // NameFunc mocks the Name method. NameFunc func() string // SizeFunc mocks the Size method. SizeFunc func() int64 // SysFunc mocks the Sys method. SysFunc func() any // contains filtered or unexported fields }
FileInfoMock is a mock implementation of FileInfo.
func TestSomethingThatUsesFileInfo(t *testing.T) { // make and configure a mocked FileInfo mockedFileInfo := &FileInfoMock{ IsDirFunc: func() bool { panic("mock out the IsDir method") }, ModTimeFunc: func() time.Time { panic("mock out the ModTime method") }, ModeFunc: func() fs.FileMode { panic("mock out the Mode method") }, NameFunc: func() string { panic("mock out the Name method") }, SizeFunc: func() int64 { panic("mock out the Size method") }, SysFunc: func() any { panic("mock out the Sys method") }, } // use mockedFileInfo in code that requires FileInfo // and then make assertions. }
func (*FileInfoMock) IsDirCalls ¶
func (mock *FileInfoMock) IsDirCalls() []struct { }
IsDirCalls gets all the calls that were made to IsDir. Check the length with:
len(mockedFileInfo.IsDirCalls())
func (*FileInfoMock) ModTime ¶
func (mock *FileInfoMock) ModTime() time.Time
ModTime calls ModTimeFunc.
func (*FileInfoMock) ModTimeCalls ¶
func (mock *FileInfoMock) ModTimeCalls() []struct { }
ModTimeCalls gets all the calls that were made to ModTime. Check the length with:
len(mockedFileInfo.ModTimeCalls())
func (*FileInfoMock) ModeCalls ¶
func (mock *FileInfoMock) ModeCalls() []struct { }
ModeCalls gets all the calls that were made to Mode. Check the length with:
len(mockedFileInfo.ModeCalls())
func (*FileInfoMock) NameCalls ¶
func (mock *FileInfoMock) NameCalls() []struct { }
NameCalls gets all the calls that were made to Name. Check the length with:
len(mockedFileInfo.NameCalls())
func (*FileInfoMock) SizeCalls ¶
func (mock *FileInfoMock) SizeCalls() []struct { }
SizeCalls gets all the calls that were made to Size. Check the length with:
len(mockedFileInfo.SizeCalls())
func (*FileInfoMock) SysCalls ¶
func (mock *FileInfoMock) SysCalls() []struct { }
SysCalls gets all the calls that were made to Sys. Check the length with:
len(mockedFileInfo.SysCalls())
type FileMock ¶
type FileMock struct { // CloseFunc mocks the Close method. CloseFunc func() error // ReadFunc mocks the Read method. ReadFunc func(bytes []byte) (int, error) // StatFunc mocks the Stat method. StatFunc func() (fs.FileInfo, error) // contains filtered or unexported fields }
FileMock is a mock implementation of File.
func TestSomethingThatUsesFile(t *testing.T) { // make and configure a mocked File mockedFile := &FileMock{ CloseFunc: func() error { panic("mock out the Close method") }, ReadFunc: func(bytes []byte) (int, error) { panic("mock out the Read method") }, StatFunc: func() (fs.FileInfo, error) { panic("mock out the Stat method") }, } // use mockedFile in code that requires File // and then make assertions. }
func (*FileMock) CloseCalls ¶
func (mock *FileMock) CloseCalls() []struct { }
CloseCalls gets all the calls that were made to Close. Check the length with:
len(mockedFile.CloseCalls())