mock

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FS

type FS struct {
	mock.Mock
}

FS mocks

func (*FS) Glob

func (fsys *FS) Glob(pattern string) ([]string, error)

Glob implements fs.GlobFS

func (*FS) MkDir

func (fsys *FS) MkDir(name string, perm fs.FileMode) error

MkDir implements writefs.MkDirFS

func (*FS) Open

func (fsys *FS) Open(name string) (fs.File, error)

Open implements fs.FS

func (*FS) OpenFile

func (fsys *FS) OpenFile(name string, flag int, perm fs.FileMode) (writefs.FileWriter, error)

OpenFile implements writefs.WriteFS

func (*FS) ReadDir

func (fsys *FS) ReadDir(name string) ([]fs.DirEntry, error)

ReadDir implements fs.ReadDirFS

func (*FS) ReadFile

func (fsys *FS) ReadFile(name string) ([]byte, error)

ReadFile implements fs.ReadFileFS

func (*FS) Remove

func (fsys *FS) Remove(name string) error

Remove implements writefs.RemoveFS

func (*FS) Stat

func (fsys *FS) Stat(name string) (fs.FileInfo, error)

Stat implements fs.StatFS

func (*FS) Sub

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

Sub implements fs.SubFS

type FileWriter

type FileWriter struct {
	mock.Mock
}

FileWriter provides a struct based on testify/mock.Mock that implements the fs.Writer.

The struct is used to test the writefs package itself, and could be generally used to test methods that expects a writefs.WriteFS instance, by providing a mocked FileWriter type that you can return from you mocked writefs.WriteFS objects.

func (*FileWriter) Close

func (w *FileWriter) Close() error

Close implements fs.Close

func (*FileWriter) Read

func (w *FileWriter) Read(buf []byte) (int, error)

Read implements fs.Read

func (*FileWriter) Stat

func (w *FileWriter) Stat() (fs.FileInfo, error)

Stat implements fs.File

func (*FileWriter) Write

func (w *FileWriter) Write(buf []byte) (int, error)

Write implements writefs.Write

Jump to

Keyboard shortcuts

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