Documentation
¶
Overview ¶
Package execxtest provides a fake execx.Runner that records every command instead of running it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrFailed = errors.New("exit status 1")
ErrFailed is a generic command failure for handlers to return.
Functions ¶
This section is empty.
Types ¶
type Fake ¶
type Fake struct {
// Handler decides the result of each Run or Output call. When nil, every
// command succeeds with no output.
Handler func(c execx.Cmd) ([]byte, error)
// Installed lists the executables LookPath reports as present.
Installed map[string]bool
// contains filtered or unexported fields
}
Fake is an execx.Runner that records commands and answers them through Handler. The zero value succeeds for every command with empty output and reports every executable as missing from PATH.
func Install ¶
Install replaces the execx runner with a new Fake for the duration of t. Tests using it must not run in parallel, since the runner is package-level.