Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var PrepareCmd = func(cmd *exec.Cmd) Runnable {
return &cmdWithStderr{cmd}
}
PrepareCmd extends exec.Cmd with extra error reporting features and provides a hook to stub command execution in tests
Functions ¶
This section is empty.
Types ¶
type CommandCallback ¶
type CommandCallback func([]string)
type CommandStubber ¶
type CommandStubber struct {
// contains filtered or unexported fields
}
CommandStubber stubs out invocations to external commands.
func Stub ¶
func Stub() (*CommandStubber, func(T))
Stub installs a catch-all for all external commands invoked from kraftkit. It returns a restore func that, when invoked from tests, fails the current test if some stubs that were registered were never matched.
func (*CommandStubber) Register ¶
func (cs *CommandStubber) Register(pattern string, exitStatus int, output string, callbacks ...CommandCallback)
Register a stub for an external command. Pattern is a regular expression, output is the standard output from a command. Pass callbacks to inspect raw arguments that the command was invoked with.
Click to show internal directories.
Click to hide internal directories.