mockexec

package
v0.0.0-...-ddafa38 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

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 CommandWhenPredicate

type CommandWhenPredicate func(args exec.RunArgs, command string) bool

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) 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) RunList

func (m *MockCommandRunner) RunList(ctx context.Context, commands []string, args exec.RunArgs) (exec.RunResult, error)

func (*MockCommandRunner) When

Registers a mock expression against the mock exec

type ResponseFn

type ResponseFn func(args exec.RunArgs) (exec.RunResult, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL