Documentation
¶
Index ¶
- type FS
- func (fsys *FS) Create(name string) (rwfs.File, error)
- func (fsys *FS) Diff(name string) string
- func (fsys *FS) DiffAll() string
- func (fsys *FS) Open(name string) (fs.File, error)
- func (fsys *FS) OpenAsWritable(name string) (rwfs.File, error)
- func (fsys FS) ReadDir(name string) ([]fs.DirEntry, error)
- func (fsys *FS) Truncate(name string, n int64) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FS ¶
type FS struct {
// contains filtered or unexported fields
}
func New ¶
New returns a new testerfs.FS that wraps the given fs.FS. The returned testerfs.FS will only persist changes in-memory, and it will be possible to diff the changes made to the testerfs.FS against the "expected" file contents for each corresponding file in the test fixture.
func NewWithFileMask ¶
NewWithFileMask returns a new testerfs.FS that wraps the given fs.FS. The returned testerfs.FS will only cover files from the underlying FS that are present in the given paths. This is useful for testing a specific subset of a larger test fixture.
func NewWithLogger ¶
NewWithLogger does the same thing as calling New, but injects a logger for observing noteworthy filesystem activity.
func NewWithRoot ¶
func (*FS) Create ¶
Create helps implement the rwfs.FS interface. The new file is persisted only in-memory, and will serve as the "actual" contents for the given path.
func (*FS) Diff ¶
Diff returns a human-readable diff between the expected and actual contents for the given file path. If there is no diff, an empty string is returned.
func (*FS) DiffAll ¶
DiffAll returns a human-readable diff for all files in the FS. If there are no diffs, an empty string is returned.
func (*FS) OpenAsWritable ¶
OpenAsWritable implements rwfs.FS.