Documentation ¶
Index ¶
- Variables
- type FSOption
- type FakeFile
- type FakeFileDescriptor
- func (m *FakeFileDescriptor) Close() error
- func (m *FakeFileDescriptor) Info() (fs.FileInfo, error)
- func (m *FakeFileDescriptor) IsDir() bool
- func (m *FakeFileDescriptor) ModTime() time.Time
- func (m *FakeFileDescriptor) Mode() fs.FileMode
- func (m *FakeFileDescriptor) Name() string
- func (m *FakeFileDescriptor) Read(b []byte) (n int, err error)
- func (m *FakeFileDescriptor) Seek(offset int64, whence int) (int64, error)
- func (m *FakeFileDescriptor) Size() int64
- func (m *FakeFileDescriptor) Stat() (fs.FileInfo, error)
- func (m *FakeFileDescriptor) Sys() any
- func (m *FakeFileDescriptor) Type() fs.FileMode
- func (m *FakeFileDescriptor) Write(src []byte) (n int, err error)
- type FakeFileSystem
- func (m *FakeFileSystem) Create(path string) (File, error)
- func (m *FakeFileSystem) Open(uncleanedPath string) (File, error)
- func (m *FakeFileSystem) OpenFile(uncleanedPath string, flag int, perm os.FileMode) (File, error)
- func (m *FakeFileSystem) ReadFile(uncleanedPath string) ([]byte, error)
- func (m *FakeFileSystem) Remove(uncleanedPath string) error
- func (m *FakeFileSystem) RemoveAll(path string) error
- func (m *FakeFileSystem) Stat(uncleanedPath string) (fs.FileInfo, error)
- func (m *FakeFileSystem) String() (pp string)
- func (m *FakeFileSystem) Truncate(uncleanedPath string, size int64) error
- func (m *FakeFileSystem) WalkDir(uncleanedRoot string, fn fs.WalkDirFunc) (err error)
- func (m *FakeFileSystem) WriteFile(uncleanedPath string, data []byte, perm os.FileMode) error
- type File
- type FileSystem
- type RealFileSystem
- func (*RealFileSystem) Create(path string) (File, error)
- func (*RealFileSystem) Open(path string) (File, error)
- func (*RealFileSystem) OpenFile(path string, flag int, perm os.FileMode) (File, error)
- func (*RealFileSystem) ReadFile(path string) ([]byte, error)
- func (*RealFileSystem) Remove(path string) error
- func (*RealFileSystem) RemoveAll(path string) error
- func (*RealFileSystem) Stat(path string) (fs.FileInfo, error)
- func (*RealFileSystem) Truncate(path string, size int64) error
- func (*RealFileSystem) WalkDir(root string, fn fs.WalkDirFunc) error
- func (*RealFileSystem) WriteFile(path string, data []byte, perm os.FileMode) error
Constants ¶
This section is empty.
Variables ¶
View Source
var Time = time.Now
Time tells the "current" time. For testing purposes, you can reassign this variable:
ffs.Time = func() (t time.Time) { // always return zero value return }
Functions ¶
This section is empty.
Types ¶
type FakeFileDescriptor ¶
type FakeFileDescriptor struct {
// contains filtered or unexported fields
}
func (*FakeFileDescriptor) Close ¶
func (m *FakeFileDescriptor) Close() error
func (*FakeFileDescriptor) IsDir ¶
func (m *FakeFileDescriptor) IsDir() bool
func (*FakeFileDescriptor) ModTime ¶
func (m *FakeFileDescriptor) ModTime() time.Time
func (*FakeFileDescriptor) Mode ¶
func (m *FakeFileDescriptor) Mode() fs.FileMode
func (*FakeFileDescriptor) Name ¶
func (m *FakeFileDescriptor) Name() string
func (*FakeFileDescriptor) Seek ¶
func (m *FakeFileDescriptor) Seek(offset int64, whence int) (int64, error)
func (*FakeFileDescriptor) Size ¶
func (m *FakeFileDescriptor) Size() int64
func (*FakeFileDescriptor) Sys ¶
func (m *FakeFileDescriptor) Sys() any
func (*FakeFileDescriptor) Type ¶
func (m *FakeFileDescriptor) Type() fs.FileMode
type FakeFileSystem ¶
type FakeFileSystem struct {
// contains filtered or unexported fields
}
func MockFS ¶
func MockFS(opts ...FSOption) (fs *FakeFileSystem)
func (*FakeFileSystem) ReadFile ¶
func (m *FakeFileSystem) ReadFile(uncleanedPath string) ([]byte, error)
func (*FakeFileSystem) Remove ¶
func (m *FakeFileSystem) Remove(uncleanedPath string) error
func (*FakeFileSystem) RemoveAll ¶
func (m *FakeFileSystem) RemoveAll(path string) error
func (*FakeFileSystem) Stat ¶
func (m *FakeFileSystem) Stat(uncleanedPath string) (fs.FileInfo, error)
func (*FakeFileSystem) String ¶
func (m *FakeFileSystem) String() (pp string)
func (*FakeFileSystem) Truncate ¶
func (m *FakeFileSystem) Truncate(uncleanedPath string, size int64) error
func (*FakeFileSystem) WalkDir ¶
func (m *FakeFileSystem) WalkDir(uncleanedRoot string, fn fs.WalkDirFunc) (err error)
type FileSystem ¶
type FileSystem interface { Create(path string) (File, error) Open(path string) (File, error) Stat(path string) (os.FileInfo, error) OpenFile(path string, flag int, perm fs.FileMode) (File, error) // @todo: Mkdir(name string, perm FileMode) error // @todo: MkdirAll(path string, perm FileMode) error WalkDir(root string, fn fs.WalkDirFunc) error Truncate(path string, size int64) error ReadFile(path string) ([]byte, error) WriteFile(path string, data []byte, perm os.FileMode) error Remove(path string) error RemoveAll(path string) error }
type RealFileSystem ¶
type RealFileSystem struct{}
func (*RealFileSystem) Remove ¶
func (*RealFileSystem) Remove(path string) error
func (*RealFileSystem) RemoveAll ¶
func (*RealFileSystem) RemoveAll(path string) error
func (*RealFileSystem) WalkDir ¶
func (*RealFileSystem) WalkDir(root string, fn fs.WalkDirFunc) error
Click to show internal directories.
Click to hide internal directories.