Documentation
Overview ¶
Package mockfs mocks interactions with the filesystem.
Index ¶
- type File
- type FileInfo
- func (f *FileInfo) FailClose() *FileInfo
- func (f *FileInfo) FailOpen() *FileInfo
- func (f *FileInfo) FailRead() *FileInfo
- func (f *FileInfo) FailStat() *FileInfo
- func (f *FileInfo) IsDir() bool
- func (f *FileInfo) ModTime() time.Time
- func (f *FileInfo) Mode() os.FileMode
- func (f *FileInfo) Name() string
- func (f *FileInfo) Size() int64
- func (f *FileInfo) Sys() interface{}
- type FileSystem
- func (f *FileSystem) Lstat(path string) (os.FileInfo, error)
- func (f *FileSystem) Mkdir(path string) *FileInfo
- func (f *FileSystem) Open(path string) (sys.File, error)
- func (f *FileSystem) Stat(path string) (os.FileInfo, error)
- func (f *FileSystem) Walk(root string, walkFn filepath.WalkFunc) error
- func (f *FileSystem) WriteFile(path string, data string) *FileInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type File ¶
type File struct {
// contains filtered or unexported fields
}
File provides a mock implementation of the sys.File interface.
type FileInfo ¶
type FileInfo struct {
// contains filtered or unexported fields
}
FileInfo provides a mock implementation of the os.FileInfo interface.
type FileSystem ¶
type FileSystem struct {
// contains filtered or unexported fields
}
FileSystem provides a configurable mock implementation of the sys.FileSystem interface.
func (*FileSystem) Lstat ¶
func (f *FileSystem) Lstat(path string) (os.FileInfo, error)
Lstat implements the interface for sys.Filesystem.
func (*FileSystem) Mkdir ¶
func (f *FileSystem) Mkdir(path string) *FileInfo
Mkdir creates a directory at the given path, along with any necessary parent directories. If a directory already exists, then the method will exit early.
WriteFile implicitly creates directories, so this method is only really useful for creating empty directories.
func (*FileSystem) Open ¶
func (f *FileSystem) Open(path string) (sys.File, error)
Open implements the interface for sys.Filesystem.
func (*FileSystem) Stat ¶
func (f *FileSystem) Stat(path string) (os.FileInfo, error)
Stat implements the interface for sys.Filesystem.