fs

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockFS

type MockFS struct {
	mock.Mock
}

MockFS is a mock file system

func New

func New(files ...*MockFile) *MockFS

New creates a new mock file system

func (*MockFS) Lstat

func (m *MockFS) Lstat(path string) (os.FileInfo, error)

Lstat gets stats

func (*MockFS) Open

func (m *MockFS) Open(path string) (vfs.ReadSeekCloser, error)

Open opens a file

func (*MockFS) ReadDir

func (m *MockFS) ReadDir(path string) ([]os.FileInfo, error)

ReadDir reads a directory

func (*MockFS) RootType

func (m *MockFS) RootType(path string) vfs.RootType

RootType gets the root type

func (*MockFS) Stat

func (m *MockFS) Stat(path string) (os.FileInfo, error)

Stat gets stats

func (*MockFS) String

func (m *MockFS) String() string

String gets the file system as a string

type MockFile

type MockFile struct {
	OverrideBuffer bool
	mock.Mock

	Buf *bytes.Reader
	// contains filtered or unexported fields
}

MockFile is a mock file

func NewFile

func NewFile(name string, data []byte, openErr, closeErr error, expectClose bool) *MockFile

NewFile creates a new file system entry

func (*MockFile) Close

func (f *MockFile) Close() error

Close closes the file

func (*MockFile) IsDir

func (f *MockFile) IsDir() bool

IsDir returns whether the file is a directory

func (*MockFile) ModTime

func (f *MockFile) ModTime() time.Time

ModTime gets the mod time of the file

func (*MockFile) Mode

func (f *MockFile) Mode() os.FileMode

Mode gets the mode of the file

func (*MockFile) Name

func (f *MockFile) Name() string

Name gets the name of the file

func (*MockFile) Read

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

Read reads from the file

func (*MockFile) Seek

func (f *MockFile) Seek(offset int64, whence int) (int64, error)

Seek seeks on the file

func (*MockFile) Size

func (f *MockFile) Size() int64

Size gets the size of the file

func (*MockFile) Sys

func (f *MockFile) Sys() interface{}

Sys gets the system specific implementation of the file info

Jump to

Keyboard shortcuts

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