Documentation
¶
Overview ¶
Package fake provides a fake implementation of the filesystem interface for unit tests
Index ¶
- type FileInfo
- type FileSystem
- func (f *FileSystem) Chmod(string, os.FileMode) error
- func (f *FileSystem) Copy(io.Writer, io.Reader) (int64, error)
- func (f *FileSystem) Create(string) (*os.File, error)
- func (f *FileSystem) MkdirAll(string, os.FileMode) error
- func (f *FileSystem) Open(string) (*os.File, error)
- func (f *FileSystem) OpenFile(string, int, os.FileMode) (*os.File, error)
- func (f *FileSystem) ReadDir(string) ([]fs.FileInfo, error)
- func (f *FileSystem) ReadFile(string) ([]byte, error)
- func (f *FileSystem) RemoveAll(string) error
- func (f *FileSystem) Rename(string, string) error
- func (f *FileSystem) Seek(*os.File, int64, int) (int64, error)
- func (f *FileSystem) Stat(string) (os.FileInfo, error)
- func (f *FileSystem) WalkAndZip(string, zipper.Zipper, *zip.Writer) error
- func (f *FileSystem) WriteStringToFile(*os.File, string) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileInfo ¶
type FileInfo struct {
FakeName string
FakeSize int64
FakeMode fs.FileMode
FakeModTime time.Time
FakeIsDir bool
FakeSYS any
}
FileInfo is a fake implementation of fs.FileInfo for unit testing.
type FileSystem ¶
type FileSystem struct {
MkDirErr []error
ReadFileResp [][]byte
ReadFileErr []error
ReadDirResp [][]fs.FileInfo
ReadDirErr []error
OpenResp []*os.File
OpenErr []error
OpenFileResp []*os.File
OpenFileErr []error
RemoveAllErr []error
CreateResp []*os.File
CreateErr []error
WriteStringToFileResp []int
WriteStringToFileErr []error
RenameErr []error
CopyResp []int64
CopyErr []error
ChmodErr []error
StatResp []os.FileInfo
StatErr []error
WalkAndZipErr []error
SeekResp []int64
SeekErr []error
// contains filtered or unexported fields
}
FileSystem provides a fake implementation of the filesystem.Filesystem interface.
func (*FileSystem) Chmod ¶
func (f *FileSystem) Chmod(string, os.FileMode) error
Chmod is a fake implementation for unit testing.
func (*FileSystem) Create ¶
func (f *FileSystem) Create(string) (*os.File, error)
Create is a fake implementation for unit testing.
func (*FileSystem) MkdirAll ¶
func (f *FileSystem) MkdirAll(string, os.FileMode) error
MkdirAll is a fake implementation for unit testing.
func (*FileSystem) Open ¶
func (f *FileSystem) Open(string) (*os.File, error)
Open is a fake implementation for unit testing.
func (*FileSystem) ReadDir ¶
func (f *FileSystem) ReadDir(string) ([]fs.FileInfo, error)
ReadDir is a fake implementation for unit testing.
func (*FileSystem) ReadFile ¶
func (f *FileSystem) ReadFile(string) ([]byte, error)
ReadFile is a fake implementation for unit testing.
func (*FileSystem) RemoveAll ¶
func (f *FileSystem) RemoveAll(string) error
RemoveAll is a fake implementation for unit testing.
func (*FileSystem) Rename ¶
func (f *FileSystem) Rename(string, string) error
Rename is a fake implementation for unit testing.
func (*FileSystem) Stat ¶
func (f *FileSystem) Stat(string) (os.FileInfo, error)
Stat is a fake implementation for unit testing.
func (*FileSystem) WalkAndZip ¶
WalkAndZip is a fake implementation for unit testing.
func (*FileSystem) WriteStringToFile ¶
WriteStringToFile is a fake implementation for unit testing.