Documentation
¶
Index ¶
- type CommandExpression
- type CommandWhenPredicate
- type MockCommandRunner
- func (m *MockCommandRunner) MockToolInPath(name string, err error)
- func (m *MockCommandRunner) Run(ctx context.Context, args exec.RunArgs) (exec.RunResult, error)
- func (m *MockCommandRunner) RunList(ctx context.Context, commands []string, args exec.RunArgs) (exec.RunResult, error)
- func (m *MockCommandRunner) ToolInPath(name string) error
- func (m *MockCommandRunner) When(predicate CommandWhenPredicate) *CommandExpression
- type ResponseFn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommandExpression ¶
type CommandExpression struct {
// contains filtered or unexported fields
}
Represents an mocked expression against a dependent tool command
func (*CommandExpression) Respond ¶
func (e *CommandExpression) Respond(response exec.RunResult) *MockCommandRunner
Sets the response that will be returned for the current expression
func (*CommandExpression) RespondFn ¶
func (e *CommandExpression) RespondFn(responseFn ResponseFn) *MockCommandRunner
Sets the response that will be returned for the current expression
func (*CommandExpression) SetError ¶
func (e *CommandExpression) SetError(err error) *MockCommandRunner
Sets the error that will be returned for the current expression
type MockCommandRunner ¶
type MockCommandRunner struct {
// contains filtered or unexported fields
}
MockCommandRunner is used to register and implement mock calls and responses out to dependent CLI applications
func NewMockCommandRunner ¶
func NewMockCommandRunner() *MockCommandRunner
Creates a new instance of a mock exec
func (*MockCommandRunner) MockToolInPath ¶
func (m *MockCommandRunner) MockToolInPath(name string, err error)
MockToolInPath allows setting up mock responses for ToolInPath calls
func (*MockCommandRunner) Run ¶
The Run definition that matches the real function definition This implementation will find the first matching, most recent mocked expression and return the configured response or error
func (*MockCommandRunner) ToolInPath ¶
func (m *MockCommandRunner) ToolInPath(name string) error
ToolInPath implements the ToolInPath method of CommandRunner interface for mocking
func (*MockCommandRunner) When ¶
func (m *MockCommandRunner) When(predicate CommandWhenPredicate) *CommandExpression
Registers a mock expression against the mock exec