Documentation
¶
Overview ¶
Package testable contains code to make npte testable.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Env = NewEnvironOS()
Env is the global *Environ.
Functions ¶
This section is empty.
Types ¶
type Environ ¶
type Environ struct {
Args []string
Exit func(code int)
Stdin io.Reader
Stdout io.Writer
Stderr io.Writer
LogRenderer *lipgloss.Renderer
Getenv func(key string) string
Geteuid func() int
MkdirAll func(path string, perm os.FileMode) error
ReadFile func(name string) ([]byte, error)
WriteFile func(name string, data []byte, perm os.FileMode) error
Stat func(name string) (os.FileInfo, error)
Remove func(name string) error
ReadDir func(name string) ([]os.DirEntry, error)
RunCommand func(cmd *exec.Cmd) error
LookPath func(file string) (string, error)
Executable func() (string, error)
LockFile func(path string) (func(), error)
LogFatalOnError0 func(err error)
}
Environ abstracts away side effects (filesystem, execution, locking, exit) so that commands can be tested without root, namespaces, or real I/O.
func NewEnvironOS ¶
func NewEnvironOS() *Environ
NewEnvironOS returns an *Environ wired to real OS operations.
Click to show internal directories.
Click to hide internal directories.