mocks

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandRunnerMock

type CommandRunnerMock struct {
	// RunFunc mocks the Run method.
	RunFunc func(ctx context.Context, name string, args ...string) (io.Reader, func() error, error)
	// contains filtered or unexported fields
}

CommandRunnerMock is a mock implementation of executor.CommandRunner.

func TestSomethingThatUsesCommandRunner(t *testing.T) {

	// make and configure a mocked executor.CommandRunner
	mockedCommandRunner := &CommandRunnerMock{
		RunFunc: func(ctx context.Context, name string, args ...string) (io.Reader, func() error, error) {
			panic("mock out the Run method")
		},
	}

	// use mockedCommandRunner in code that requires executor.CommandRunner
	// and then make assertions.

}

func (*CommandRunnerMock) Run

func (mock *CommandRunnerMock) Run(ctx context.Context, name string, args ...string) (io.Reader, func() error, error)

Run calls RunFunc.

func (*CommandRunnerMock) RunCalls

func (mock *CommandRunnerMock) RunCalls() []struct {
	Ctx  context.Context
	Name string
	Args []string
}

RunCalls gets all the calls that were made to Run. Check the length with:

len(mockedCommandRunner.RunCalls())

Jump to

Keyboard shortcuts

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