Documentation
¶
Overview ¶
This package provides an interface to functions and structs in the standard os package to facilitate mocking.
Index ¶
Constants ¶
View Source
const ( O_RDONLY = os.O_RDONLY O_WRONLY = os.O_WRONLY O_RDWR = os.O_RDWR O_APPEND = os.O_APPEND O_CREATE = os.O_CREATE O_EXCL = os.O_EXCL O_SYNC = os.O_SYNC O_TRUNC = os.O_TRUNC SEEK_SET = os.SEEK_SET SEEK_CUR = os.SEEK_CUR SEEK_END = os.SEEK_END PathSeparator = os.PathSeparator PathListSeparator = os.PathListSeparator DevNull = os.DevNull )
Variables ¶
View Source
var ( ModeFile = fs.ModeFile ModeDir = fs.ModeDir ModeAppend = fs.ModeAppend ModeExclusive = fs.ModeExclusive ModeTemporary = fs.ModeTemporary ModeSymlink = fs.ModeSymlink ModeDevice = fs.ModeDevice ModeNamedPipe = fs.ModeNamedPipe ModeSocket = fs.ModeSocket ModeSetuid = fs.ModeSetuid ModeSetgid = fs.ModeSetgid ModeCharDevice = fs.ModeCharDevice ModeSticky = fs.ModeSticky ModeIrregular = fs.ModeIrregular ModePerm = os.ModePerm )
View Source
var ( ErrInvalid = os.ErrInvalid ErrPermission = os.ErrPermission ErrExist = os.ErrExist ErrNotExist = os.ErrNotExist ErrClosed = os.ErrClosed ErrNoDeadline = os.ErrNoDeadline ErrDeadlineExceeded = os.ErrDeadlineExceeded ErrProcessDone = os.ErrProcessDone )
Functions ¶
func WrapFile ¶ added in v0.2.1
This is a basic constructor, but I didn't want to name it New* because that might imply that it actually creates a file.
func WrapProcess ¶ added in v0.2.1
Types ¶
type FSFileMode ¶ added in v0.2.1
type FSFileMode = fs.FSFileMode
type File ¶
type File interface {
Chdir() error
Chmod(FSFileMode) error
Chown(int, int) error
Close() error
Fd() uintptr
Name() string
Read([]byte) (int, error)
ReadAt([]byte, int64) (int, error)
ReadDir(int) ([]DirEntry, error)
ReadFrom(io.Reader) (int64, error)
Readdir(int) ([]FileInfo, error)
Readdirnames(int) ([]string, error)
Seek(int64, int) (int64, error)
SetDeadline(time.Time) error
SetReadDeadline(time.Time) error
SetWriteDeadline(time.Time) error
Stat() (FileInfo, error)
Sync() error
SyscallConn() (syscall.RawConn, error)
Truncate(int64) error
Write([]byte) (int, error)
WriteAt([]byte, int64) (int, error)
WriteString(string) (int, error)
WriteTo(io.Writer) (int64, error)
}
type OS ¶
type OS interface {
// Access to global variables:
Stdin() File
Stderr() File
Stdout() File
Args() []string
// Functions:
Chdir(string) error
Chmod(string, FSFileMode) error
Chown(string, int, int) error
Chtimes(string, time.Time, time.Time) error
Clearenv()
CopyFS(string, fs.FS) error
DirFS(string) fs.FS
Environ() []string
Executable() (string, error)
Exit(int)
Expand(string, func(string) string) string
ExpandEnv(string) string
Getegid() int
Getenv(string) string
Geteuid() int
Getgid() int
Getgroups() ([]int, error)
Getpagesize() int
Getpid() int
Getppid() int
Getuid() int
Getwd() (string, error)
Hostname() (string, error)
IsExist(error) bool // Deprecated
IsNotExist(error) bool // Deprecated
IsPathSeparator(uint8) bool
IsPermission(error) bool // Deprecated
IsTimeout(error) bool // Deprecated
Lchown(string, int, int) error
Link(string, string) error
LookupEnv(string) (string, bool)
Mkdir(string, FSFileMode) error
MkdirAll(string, FSFileMode) error
MkdirTemp(string, string) (string, error)
NewSyscallError(string, error) error
Pipe() (File, File, error)
ReadFile(string) ([]byte, error)
Readlink(string) (string, error)
Remove(string) error
RemoveAll(string) error
Rename(string, string) error
SameFile(FileInfo, FileInfo) bool
Setenv(string, string) error
Symlink(string, string) error
TempDir() string
Truncate(string, int64) error
Unsetenv(string) error
UserCacheDir() (string, error)
UserConfigDir() (string, error)
UserHomeDir() (string, error)
WriteFile(string, []byte, FSFileMode) error
// DirEntry constructors
ReadDir(string) ([]DirEntry, error)
// File constructors
Create(string) (File, error)
CreateTemp(string, string) (File, error)
NewFile(uintptr, string) File
Open(string) (File, error)
OpenFile(string, int, FSFileMode) (File, error)
OpenInRoot(string, string) (File, error)
// FileInfo constructors
Lstat(string) (FileInfo, error)
Stat(string) (FileInfo, error)
// Process constructors
FindProcess(int) (Process, error)
StartProcess(string, []string, *ProcAttr) (Process, error)
// Root constructors
OpenRoot(string) (Root, error)
}
type ProcessState ¶
type ProcessState = os.ProcessState
type Root ¶
type Root interface {
Close() error
Create(string) (File, error)
FS() fs.FS
Lstat(string) (FileInfo, error)
Mkdir(string, FSFileMode) error
Name() string
Open(string) (File, error)
OpenFile(string, int, FSFileMode) (File, error)
OpenRoot(string) (Root, error)
Remove(string) error
Stat(string) (FileInfo, error)
Nub() *os.Root
}
type SyscallError ¶
type SyscallError = os.SyscallError
Directories
¶
| Path | Synopsis |
|---|---|
|
This package provides an interface to functions and structs in the standard os/exec package to facilitate mocking.
|
This package provides an interface to functions and structs in the standard os/exec package to facilitate mocking. |
|
This package provides an interface to functions and structs in the standard os/signal package to facilitate mocking.
|
This package provides an interface to functions and structs in the standard os/signal package to facilitate mocking. |
Click to show internal directories.
Click to hide internal directories.