kfstest

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TestFS

func TestFS(fsys fs.FS, files ...TestFSFile) error

TestFS tests fs operations:

  • Open
  • Stat
  • ReadFile
  • ReadDir
  • Glob
  • Sub

func TestFileAppend

func TestFileAppend(fsys fs.FS, name string, data []byte) error

TestFileAppend tests appending to a file with kfs.OpenFile

func TestFileOpen

func TestFileOpen(fsys fs.FS, name string, data []byte) (retErr error)

TestFileOpen tests reading a file using Open

func TestFileWrite

func TestFileWrite(fsys fs.FS, name string, data []byte) error

TestFileWrite tests writing a file with kfs.OpenFile

Types

type MapFS

type MapFS struct {
	Fsys fstest.MapFS
}

MapFS is an in-memory kfs.FS

func (*MapFS) Chtimes added in v0.1.2

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

func (*MapFS) FullFilePath added in v0.1.3

func (m *MapFS) FullFilePath(name string) (string, error)

func (*MapFS) Glob

func (m *MapFS) Glob(pattern string) ([]string, error)

func (*MapFS) Lstat

func (m *MapFS) Lstat(name string) (fs.FileInfo, error)

func (*MapFS) Open

func (m *MapFS) Open(name string) (fs.File, error)

func (*MapFS) OpenFile

func (m *MapFS) OpenFile(name string, flag int, mode fs.FileMode) (kfs.File, error)

func (*MapFS) ReadDir

func (m *MapFS) ReadDir(name string) ([]fs.DirEntry, error)

func (*MapFS) ReadFile

func (m *MapFS) ReadFile(name string) ([]byte, error)
func (m *MapFS) ReadLink(name string) (string, error)

func (*MapFS) Remove

func (m *MapFS) Remove(name string) error

func (*MapFS) RemoveAll

func (m *MapFS) RemoveAll(name string) error

func (*MapFS) Stat

func (m *MapFS) Stat(name string) (fs.FileInfo, error)

func (*MapFS) Sub

func (m *MapFS) Sub(dir string) (fs.FS, error)

type TestFSFile

type TestFSFile struct {
	Name string
	Data []byte
}

TestFSFile specifies files to test by TestFS

Jump to

Keyboard shortcuts

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