Documentation ¶
Overview ¶
Package aferomock provides mock for spf13/afero.
Index ¶
- Variables
- type File
- func (_m *File) Close() error
- func (_m *File) Name() string
- func (_m *File) Read(p []byte) (int, error)
- func (_m *File) ReadAt(p []byte, off int64) (int, error)
- func (_m *File) Readdir(count int) ([]fs.FileInfo, error)
- func (_m *File) Readdirnames(n int) ([]string, error)
- func (_m *File) Seek(offset int64, whence int) (int64, error)
- func (_m *File) Stat() (fs.FileInfo, error)
- func (_m *File) Sync() error
- func (_m *File) Truncate(size int64) error
- func (_m *File) Write(p []byte) (int, error)
- func (_m *File) WriteAt(p []byte, off int64) (int, error)
- func (_m *File) WriteString(s string) (int, error)
- type FileCallbacks
- func (f FileCallbacks) Close() error
- func (f FileCallbacks) Name() string
- func (f FileCallbacks) Read(p []byte) (int, error)
- func (f FileCallbacks) ReadAt(p []byte, off int64) (int, error)
- func (f FileCallbacks) Readdir(count int) ([]fs.FileInfo, error)
- func (f FileCallbacks) Readdirnames(n int) ([]string, error)
- func (f FileCallbacks) Seek(offset int64, whence int) (int64, error)
- func (f FileCallbacks) Stat() (fs.FileInfo, error)
- func (f FileCallbacks) Sync() error
- func (f FileCallbacks) Truncate(size int64) error
- func (f FileCallbacks) Write(p []byte) (int, error)
- func (f FileCallbacks) WriteAt(p []byte, off int64) (int, error)
- func (f FileCallbacks) WriteString(s string) (int, error)
- type FileInfo
- type FileInfoCallbacks
- type FileInfoMocker
- type FileMocker
- type Fs
- func (_m *Fs) Chmod(name string, mode fs.FileMode) error
- func (_m *Fs) Chown(name string, uid int, gid int) error
- func (_m *Fs) Chtimes(name string, atime time.Time, mtime time.Time) error
- func (_m *Fs) Create(name string) (afero.File, error)
- func (_m *Fs) Mkdir(name string, perm fs.FileMode) error
- func (_m *Fs) MkdirAll(path string, perm fs.FileMode) error
- func (_m *Fs) Name() string
- func (_m *Fs) Open(name string) (afero.File, error)
- func (_m *Fs) OpenFile(name string, flag int, perm fs.FileMode) (afero.File, error)
- func (_m *Fs) Remove(name string) error
- func (_m *Fs) RemoveAll(path string) error
- func (_m *Fs) Rename(oldname string, newname string) error
- func (_m *Fs) Stat(name string) (fs.FileInfo, error)
- type FsCallbacks
- func (fs FsCallbacks) Chmod(name string, mode fs.FileMode) error
- func (fs FsCallbacks) Chown(name string, uid int, gid int) error
- func (fs FsCallbacks) Chtimes(name string, atime time.Time, mtime time.Time) error
- func (fs FsCallbacks) Create(name string) (afero.File, error)
- func (fs FsCallbacks) Mkdir(name string, perm fs.FileMode) error
- func (fs FsCallbacks) MkdirAll(path string, perm fs.FileMode) error
- func (fs FsCallbacks) Name() string
- func (fs FsCallbacks) Open(name string) (afero.File, error)
- func (fs FsCallbacks) OpenFile(name string, flag int, perm fs.FileMode) (afero.File, error)
- func (fs FsCallbacks) Remove(name string) error
- func (fs FsCallbacks) RemoveAll(path string) error
- func (fs FsCallbacks) Rename(oldname string, newname string) error
- func (fs FsCallbacks) Stat(name string) (fs.FileInfo, error)
- type FsMocker
- type WrappedFs
Constants ¶
This section is empty.
Variables ¶
var NoMockFileInfo = NopFileInfo
NoMockFileInfo is no mock FileInfo. Deprecated: use NopFileInfo instead.
var NoMockFs = NopFs
NoMockFs is no mock Fs. Deprecated: use NopFs instead.
var NopFile = MockFile()
NopFile is no mock File.
var NopFileInfo = MockFileInfo()
NopFileInfo is no mock FileInfo.
var NopFs = MockFs()
NopFs is no mock Fs.
Functions ¶
This section is empty.
Types ¶
type File ¶ added in v0.5.0
File is an autogenerated mock type for the File type
func NewFile ¶ added in v0.5.0
NewFile creates a new instance of File. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*File) Readdirnames ¶ added in v0.5.0
Readdirnames provides a mock function with given fields: n
type FileCallbacks ¶ added in v0.6.0
type FileCallbacks struct { CloseFunc func() error NameFunc func() string ReadFunc func(p []byte) (int, error) ReadAtFunc func(p []byte, off int64) (int, error) ReaddirFunc func(count int) ([]fs.FileInfo, error) ReaddirnamesFunc func(n int) ([]string, error) SeekFunc func(offset int64, whence int) (int64, error) StatFunc func() (fs.FileInfo, error) SyncFunc func() error TruncateFunc func(size int64) error WriteFunc func(p []byte) (int, error) WriteAtFunc func(p []byte, off int64) (int, error) WriteStringFunc func(s string) (int, error) }
FileCallbacks is a callback-based mock for afero.File.
func OverrideFile ¶ added in v0.6.0
func OverrideFile(file afero.File, c FileCallbacks) FileCallbacks
OverrideFile overrides the afero.File methods with the provided callbacks.
func (FileCallbacks) Close ¶ added in v0.6.0
func (f FileCallbacks) Close() error
Close satisfies the afero.File interface.
func (FileCallbacks) Name ¶ added in v0.6.0
func (f FileCallbacks) Name() string
Name satisfies the afero.File interface.
func (FileCallbacks) Read ¶ added in v0.6.0
func (f FileCallbacks) Read(p []byte) (int, error)
Read satisfies the afero.File interface.
func (FileCallbacks) ReadAt ¶ added in v0.6.0
func (f FileCallbacks) ReadAt(p []byte, off int64) (int, error)
ReadAt satisfies the afero.File interface.
func (FileCallbacks) Readdir ¶ added in v0.6.0
func (f FileCallbacks) Readdir(count int) ([]fs.FileInfo, error)
Readdir satisfies the afero.File interface.
func (FileCallbacks) Readdirnames ¶ added in v0.6.0
func (f FileCallbacks) Readdirnames(n int) ([]string, error)
Readdirnames satisfies the afero.File interface.
func (FileCallbacks) Seek ¶ added in v0.6.0
func (f FileCallbacks) Seek(offset int64, whence int) (int64, error)
Seek satisfies the afero.File interface.
func (FileCallbacks) Stat ¶ added in v0.6.0
func (f FileCallbacks) Stat() (fs.FileInfo, error)
Stat satisfies the afero.File interface.
func (FileCallbacks) Sync ¶ added in v0.6.0
func (f FileCallbacks) Sync() error
Sync satisfies the afero.File interface.
func (FileCallbacks) Truncate ¶ added in v0.6.0
func (f FileCallbacks) Truncate(size int64) error
Truncate satisfies the afero.File interface.
func (FileCallbacks) Write ¶ added in v0.6.0
func (f FileCallbacks) Write(p []byte) (int, error)
Write satisfies the afero.File interface.
func (FileCallbacks) WriteAt ¶ added in v0.6.0
func (f FileCallbacks) WriteAt(p []byte, off int64) (int, error)
WriteAt satisfies the afero.File interface.
func (FileCallbacks) WriteString ¶ added in v0.6.0
func (f FileCallbacks) WriteString(s string) (int, error)
WriteString satisfies the afero.File interface.
type FileInfo ¶
FileInfo is an autogenerated mock type for the FileInfo type
func NewFileInfo ¶
NewFileInfo creates a new instance of FileInfo. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
type FileInfoCallbacks ¶ added in v0.7.0
type FileInfoCallbacks struct { NameFunc func() string SizeFunc func() int64 ModeFunc func() fs.FileMode ModTimeFunc func() time.Time IsDirFunc func() bool SysFunc func() interface{} }
FileInfoCallbacks is a callback-based mock for fs.FileInfo.
func OverrideFileInfo ¶ added in v0.7.0
func OverrideFileInfo(fi fs.FileInfo, c FileInfoCallbacks) FileInfoCallbacks
OverrideFileInfo overrides the fs.FileInfo methods with the provided callbacks.
func (FileInfoCallbacks) IsDir ¶ added in v0.7.0
func (f FileInfoCallbacks) IsDir() bool
IsDir satisfies the fs.FileInfo interface.
func (FileInfoCallbacks) ModTime ¶ added in v0.7.0
func (f FileInfoCallbacks) ModTime() time.Time
ModTime satisfies the fs.FileInfo interface.
func (FileInfoCallbacks) Mode ¶ added in v0.7.0
func (f FileInfoCallbacks) Mode() fs.FileMode
Mode satisfies the fs.FileInfo interface.
func (FileInfoCallbacks) Name ¶ added in v0.7.0
func (f FileInfoCallbacks) Name() string
Name satisfies the fs.FileInfo interface.
func (FileInfoCallbacks) Size ¶ added in v0.7.0
func (f FileInfoCallbacks) Size() int64
Size satisfies the fs.FileInfo interface.
func (FileInfoCallbacks) Sys ¶ added in v0.7.0
func (f FileInfoCallbacks) Sys() interface{}
Sys satisfies the fs.FileInfo interface.
type FileInfoMocker ¶
FileInfoMocker is FileInfo mocker.
func MockFileInfo ¶
func MockFileInfo(mocks ...func(fi *FileInfo)) FileInfoMocker
MockFileInfo creates FileInfo mock with cleanup to ensure all the expectations are met.
type FileMocker ¶ added in v0.5.0
FileMocker is File mocker.
func MockFile ¶ added in v0.5.0
func MockFile(mocks ...func(f *File)) FileMocker
MockFile creates File mock with cleanup to ensure all the expectations are met.
type Fs ¶
Fs is an autogenerated mock type for the Fs type
func NewFs ¶
NewFs creates a new instance of Fs. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
type FsCallbacks ¶ added in v0.6.0
type FsCallbacks struct { ChmodFunc func(name string, mode fs.FileMode) error ChownFunc func(name string, uid int, gid int) error ChtimesFunc func(name string, atime time.Time, mtime time.Time) error CreateFunc func(name string) (afero.File, error) MkdirFunc func(name string, perm fs.FileMode) error MkdirAllFunc func(path string, perm fs.FileMode) error NameFunc func() string OpenFunc func(name string) (afero.File, error) OpenFileFunc func(name string, flag int, perm fs.FileMode) (afero.File, error) RemoveFunc func(name string) error RemoveAllFunc func(path string) error RenameFunc func(oldname string, newname string) error StatFunc func(name string) (fs.FileInfo, error) }
FsCallbacks is a callback-based mock for afero.Fs.
func OverrideFs ¶ added in v0.6.0
func OverrideFs(fs afero.Fs, c FsCallbacks) FsCallbacks
OverrideFs overrides a afero.Fs with custom callbacks.
func WrapFs ¶ added in v0.5.0
func WrapFs(fs afero.Fs, callbacks WrappedFs) FsCallbacks
WrapFs wraps a afero.Fs with custom callbacks. Deprecated: Use OverrideFs instead.
func (FsCallbacks) Chmod ¶ added in v0.6.0
func (fs FsCallbacks) Chmod(name string, mode fs.FileMode) error
Chmod satisfies the afero.Fs interface.
func (FsCallbacks) Chown ¶ added in v0.6.0
func (fs FsCallbacks) Chown(name string, uid int, gid int) error
Chown satisfies the afero.Fs interface.
func (FsCallbacks) Create ¶ added in v0.6.0
func (fs FsCallbacks) Create(name string) (afero.File, error)
Create satisfies the afero.Fs interface.
func (FsCallbacks) Mkdir ¶ added in v0.6.0
func (fs FsCallbacks) Mkdir(name string, perm fs.FileMode) error
Mkdir satisfies the afero.Fs interface.
func (FsCallbacks) MkdirAll ¶ added in v0.6.0
func (fs FsCallbacks) MkdirAll(path string, perm fs.FileMode) error
MkdirAll satisfies the afero.Fs interface.
func (FsCallbacks) Name ¶ added in v0.6.0
func (fs FsCallbacks) Name() string
Name satisfies the afero.Fs interface.
func (FsCallbacks) Open ¶ added in v0.6.0
func (fs FsCallbacks) Open(name string) (afero.File, error)
Open satisfies the afero.Fs interface.
func (FsCallbacks) Remove ¶ added in v0.6.0
func (fs FsCallbacks) Remove(name string) error
Remove satisfies the afero.Fs interface.
func (FsCallbacks) RemoveAll ¶ added in v0.6.0
func (fs FsCallbacks) RemoveAll(path string) error
RemoveAll satisfies the afero.Fs interface.
type WrappedFs ¶ added in v0.5.0
type WrappedFs = FsCallbacks
WrappedFs is a type alias for FsCallbacks. Deprecated: Use FsCallbacks instead.