fs

package
v0.0.0-...-4e216c0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeFileSystem

type FakeFileSystem struct {
	ChmodFile  []string
	ChmodMode  os.FileMode
	ChmodError map[string]error

	RenameFrom  string
	RenameTo    string
	RenameError error

	MkdirAllDir   []string
	MkdirAllError error

	MkdirDir   string
	MkdirError error

	ExistsFile   []string
	ExistsResult map[string]bool

	CopySource string
	CopyDest   string
	CopyError  error

	FilesToIgnore map[string]string

	RemoveDirName  string
	RemoveDirError error

	WorkingDirCalled bool
	WorkingDirResult string
	WorkingDirError  error

	OpenFile       string
	OpenFileResult *FakeReadCloser
	OpenContent    string
	OpenError      error
	OpenCloseError error

	CreateFile    string
	CreateContent FakeWriteCloser
	CreateError   error

	WriteFileName    string
	WriteFileError   error
	WriteFileContent string

	ReadlinkName  string
	ReadlinkError error

	SymlinkOldname string
	SymlinkNewname string
	SymlinkError   error

	Files []os.FileInfo
	// contains filtered or unexported fields
}

FakeFileSystem provides a fake filesystem structure for testing

func (*FakeFileSystem) Chmod

func (f *FakeFileSystem) Chmod(file string, mode os.FileMode) error

Chmod manipulates permissions on the fake filesystem

func (*FakeFileSystem) Copy

func (f *FakeFileSystem) Copy(sourcePath, targetPath string, filesToIgnore map[string]string) error

Copy copies files on the fake filesystem

func (*FakeFileSystem) CopyContents

func (f *FakeFileSystem) CopyContents(sourcePath, targetPath string, filesToIgnore map[string]string) error

CopyContents copies directory contents on the fake filesystem

func (*FakeFileSystem) Create

func (f *FakeFileSystem) Create(file string) (io.WriteCloser, error)

Create creates a file

func (*FakeFileSystem) CreateWorkingDirectory

func (f *FakeFileSystem) CreateWorkingDirectory() (string, error)

CreateWorkingDirectory creates a fake working directory

func (*FakeFileSystem) Exists

func (f *FakeFileSystem) Exists(file string) bool

Exists checks if the file exists in fake filesystem

func (f *FakeFileSystem) KeepSymlinks(k bool)

KeepSymlinks controls whether to handle symlinks as symlinks or follow symlinks and copy files with content

func (*FakeFileSystem) Lstat

func (f *FakeFileSystem) Lstat(p string) (os.FileInfo, error)

Lstat provides stats about a single file (not following symlinks)

func (*FakeFileSystem) Mkdir

func (f *FakeFileSystem) Mkdir(dirname string) error

Mkdir creates a new directory on the fake filesystem

func (*FakeFileSystem) MkdirAll

func (f *FakeFileSystem) MkdirAll(dirname string) error

MkdirAll creates a new directories on the fake filesystem

func (*FakeFileSystem) MkdirAllWithPermissions

func (f *FakeFileSystem) MkdirAllWithPermissions(dirname string, perm os.FileMode) error

MkdirAllWithPermissions creates a new directories on the fake filesystem

func (*FakeFileSystem) Open

func (f *FakeFileSystem) Open(file string) (io.ReadCloser, error)

Open opens a file

func (*FakeFileSystem) ReadDir

func (f *FakeFileSystem) ReadDir(p string) ([]os.FileInfo, error)

ReadDir reads the files in specified directory

func (f *FakeFileSystem) Readlink(name string) (string, error)

Readlink reads the destination of a symlink

func (*FakeFileSystem) RemoveDirectory

func (f *FakeFileSystem) RemoveDirectory(dir string) error

RemoveDirectory removes a directory in the fake filesystem

func (*FakeFileSystem) Rename

func (f *FakeFileSystem) Rename(from, to string) error

Rename renames files on the fake filesystem

func (f *FakeFileSystem) ShouldKeepSymlinks() bool

ShouldKeepSymlinks informs whether to handle symlinks as symlinks or follow symlinks and copy files by content

func (*FakeFileSystem) Stat

func (f *FakeFileSystem) Stat(p string) (os.FileInfo, error)

Stat returns a FileInfo describing the named file

func (f *FakeFileSystem) Symlink(oldname, newname string) error

Symlink creates a symlink at newname, pointing to oldname

func (*FakeFileSystem) Walk

func (f *FakeFileSystem) Walk(root string, walkFn filepath.WalkFunc) error

Walk walks the file tree rooted at root, calling walkFn for each file or directory in the tree, including root.

func (*FakeFileSystem) WriteFile

func (f *FakeFileSystem) WriteFile(file string, data []byte) error

WriteFile writes a file

type FakeReadCloser

type FakeReadCloser struct {
	*bytes.Buffer
	CloseCalled bool
	CloseError  error
}

FakeReadCloser provider a fake ReadCloser

func (*FakeReadCloser) Close

func (f *FakeReadCloser) Close() error

Close closes the fake ReadCloser

type FakeWriteCloser

type FakeWriteCloser struct {
	bytes.Buffer
}

FakeWriteCloser provider a fake ReadCloser

func (*FakeWriteCloser) Close

func (f *FakeWriteCloser) Close() error

Close closes the fake ReadCloser

Jump to

Keyboard shortcuts

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