testutils

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

cSpell: words testutils

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockExecutor

type MockExecutor struct {
	mock.Mock
}

func (*MockExecutor) Pipe

func (m *MockExecutor) Pipe(
	stdin io.Reader,
	combined bool,
	cmd string,
	arguments ...string,
) ([]byte, error)

Pipe executes a command with the provided arguments and optionally combines the standard output and standard error streams. It allows for input to be passed via an io.Reader.

Parameters:

  • stdin: An io.Reader providing input to the command.
  • combined: A boolean indicating whether to combine stdout and stderr.
  • cmd: The command to execute.
  • arguments: Additional arguments to pass to the command.

Returns:

  • A byte slice containing the command's output.
  • An error if the command execution fails.

func (*MockExecutor) Run

func (m *MockExecutor) Run(combined bool, cmd string, arguments ...string) ([]byte, error)

Run executes a command with the specified arguments and returns the output or an error.

Parameters:

  • combined: A boolean indicating whether to combine stdout and stderr.
  • cmd: The command to be executed as a string.
  • arguments: A variadic slice of strings representing the command arguments.

Returns:

  • A byte slice containing the command output.
  • An error if the command execution fails.

Jump to

Keyboard shortcuts

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