mockfs

package
v0.0.0-...-aa4546b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 1, 2024 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(base afero.Fs, cbs *MockCbs) afero.Fs

Types

type File

type File struct {
	// contains filtered or unexported fields
}

func (File) Close

func (f File) Close() error

func (File) Name

func (f File) Name() string

func (File) Read

func (f File) Read(p []byte) (n int, err error)

func (File) ReadAt

func (f File) ReadAt(p []byte, off int64) (n int, err error)

func (File) Readdir

func (f File) Readdir(count int) ([]os.FileInfo, error)

func (File) Readdirnames

func (f File) Readdirnames(n int) ([]string, error)

func (File) Seek

func (f File) Seek(offset int64, whence int) (int64, error)

func (File) Stat

func (f File) Stat() (os.FileInfo, error)

func (File) Sync

func (f File) Sync() error

func (File) Truncate

func (f File) Truncate(size int64) error

func (File) Write

func (f File) Write(p []byte) (n int, err error)

func (File) WriteAt

func (f File) WriteAt(p []byte, off int64) (n int, err error)

func (File) WriteString

func (f File) WriteString(s string) (ret int, err error)

type MockCbs

type MockCbs struct {
	AfsMkdir     func(mfs afero.Fs, name string, perm os.FileMode) error
	AfsMkdirAll  func(mfs afero.Fs, path string, perm os.FileMode) error
	AfsCreate    func(mfs afero.Fs, name string) (afero.File, error)
	AfsStat      func(mfs afero.Fs, name string) (os.FileInfo, error)
	AfsOpen      func(mfs afero.Fs, name string) (afero.File, error)
	AfsRemoveAll func(mfs afero.Fs, name string) error
	AfsChtimes   func(mfs afero.Fs, name string, atime time.Time, mtime time.Time) error
	AfsRename    func(mfs afero.Fs, oldname, newname string) error
	AfsOpenFile  func(mfs afero.Fs, name string, flag int, perm os.FileMode) (afero.File, error)
	AfiWrite     func(mfi afero.File, p []byte) (n int, err error)
	AfiReaddir   func(mfi afero.File, count int) ([]os.FileInfo, error)
	AfiRead      func(mfi afero.File, p []byte) (n int, err error)
	AfiClose     func(mfi afero.File) error
}

type MockFs

type MockFs struct {
	// contains filtered or unexported fields
}

func (MockFs) Chmod

func (m MockFs) Chmod(name string, mode os.FileMode) error

func (MockFs) Chown

func (m MockFs) Chown(name string, uid, gid int) error

func (MockFs) Chtimes

func (m MockFs) Chtimes(name string, atime time.Time, mtime time.Time) error

func (MockFs) Create

func (m MockFs) Create(name string) (afero.File, error)

func (MockFs) GetBase

func (m MockFs) GetBase() afero.Fs

func (MockFs) Mkdir

func (m MockFs) Mkdir(name string, perm os.FileMode) error

func (MockFs) MkdirAll

func (m MockFs) MkdirAll(path string, perm os.FileMode) error

func (MockFs) Name

func (m MockFs) Name() string

func (MockFs) Open

func (m MockFs) Open(name string) (afero.File, error)

func (MockFs) OpenFile

func (m MockFs) OpenFile(name string, flag int, perm os.FileMode) (afero.File, error)

func (MockFs) Remove

func (m MockFs) Remove(name string) error

func (MockFs) RemoveAll

func (m MockFs) RemoveAll(name string) error

func (MockFs) Rename

func (m MockFs) Rename(oldname, newname string) error

func (MockFs) Stat

func (m MockFs) Stat(name string) (os.FileInfo, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL