Documentation ¶
Overview ¶
Package mockfs implements in-memory filesystem for testing.
Index ¶
- type Directory
- func (imd *Directory) AddDir(name string, permissions os.FileMode) *Directory
- func (imd *Directory) AddFile(name string, content []byte, permissions os.FileMode) *File
- func (imd *Directory) AddFileLines(name string, lines []string, permissions os.FileMode) *File
- func (imd *Directory) Child(ctx context.Context, name string) (fs.Entry, error)
- func (imd *Directory) FailReaddir(err error)
- func (e Directory) IsDir() bool
- func (e Directory) ModTime() time.Time
- func (e Directory) Mode() os.FileMode
- func (e Directory) Name() string
- func (imd *Directory) OnReaddir(cb func())
- func (e Directory) Owner() fs.OwnerInfo
- func (imd *Directory) Readdir(ctx context.Context) (fs.Entries, error)
- func (imd *Directory) Remove(name string)
- func (e Directory) Size() int64
- func (imd *Directory) Subdir(name ...string) *Directory
- func (e Directory) Sys() interface{}
- type File
- func (e File) IsDir() bool
- func (e File) ModTime() time.Time
- func (e File) Mode() os.FileMode
- func (e File) Name() string
- func (imf *File) Open(ctx context.Context) (fs.Reader, error)
- func (e File) Owner() fs.OwnerInfo
- func (imf *File) SetContents(b []byte)
- func (e File) Size() int64
- func (e File) Sys() interface{}
- type ReaderSeekerCloser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Directory ¶
type Directory struct {
// contains filtered or unexported fields
}
Directory is mock in-memory implementation of fs.Directory.
func (*Directory) AddFile ¶
AddFile adds a mock file with the specified name, content and permissions.
func (*Directory) AddFileLines ¶
AddFileLines adds a mock file with the specified name, text content and permissions.
func (*Directory) FailReaddir ¶
FailReaddir causes the subsequent Readdir() calls to fail with the specified error.
func (*Directory) OnReaddir ¶ added in v0.6.0
func (imd *Directory) OnReaddir(cb func())
OnReaddir invokes the provided function on read.
Click to show internal directories.
Click to hide internal directories.