filesystem

package
v3.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockFile

type MockFile struct {
	mock.Mock
	// contains filtered or unexported fields
}

MockFile is the simple implementation of vfs.ReadSeekCloser

var NilFile *MockFile

NilFile is a nil mockfile for easy reference

func NewMockFile

func NewMockFile(data []byte) *MockFile

NewMockFile creates a new mock file for use with the mock file system

func (*MockFile) Close

func (m *MockFile) Close() error

Close does nothing

func (*MockFile) IsDir

func (m *MockFile) IsDir() bool

IsDir is an abbreviation for Mode().IsDir()

func (*MockFile) ModTime

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

ModTime returns the modification time

func (*MockFile) Mode

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

Mode returns the file mode bits

func (*MockFile) Name

func (m *MockFile) Name() string

Name returns the base name of the file

func (*MockFile) Read

func (m *MockFile) Read(dst []byte) (int, error)

Read reads from the buffer

func (*MockFile) Seek

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

Seek sets the read/write header

func (*MockFile) Size

func (m *MockFile) Size() int64

Size returns the length in bytes for regular files; system-dependent for others

func (*MockFile) Sys

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

Sys returns the underlying data source (can return nil)

type MockReader

type MockReader struct {
	mock.Mock
}

MockReader is a mock implementation of the Opener interface, for testing purposes

func NewMockFileSystem

func NewMockFileSystem(files ...MockFile) *MockReader

NewMockFileSystem creates a new mock Reader

func (*MockReader) Lstat

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

Lstat does stat stuff

func (*MockReader) Open

func (m *MockReader) Open(filename string) (vfs.ReadSeekCloser, error)

Open returns a pre-set data/error pair

func (*MockReader) ReadDir

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

ReadDir walks the directory

func (*MockReader) RootType

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

RootType returns the Root Type

func (*MockReader) Stat

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

Stat gets file stats

func (*MockReader) String

func (m *MockReader) String() string

Jump to

Keyboard shortcuts

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