Documentation
¶
Overview ¶
Package clitest provides parallel-safe in-process command execution helpers.
Index ¶
- type Execution
- func (execution Execution) AssertCommand(testingContext testing.TB, want string)
- func (execution Execution) AssertErrorIs(testingContext testing.TB, target error)
- func (execution Execution) AssertExitCode(testingContext testing.TB, want int)
- func (execution Execution) AssertStderr(testingContext testing.TB, want string)
- func (execution Execution) AssertStdout(testingContext testing.TB, want string)
- func (execution Execution) AssertSuccess(testingContext testing.TB)
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Execution ¶
Execution captures one isolated in-process command result.
func Run ¶
func Run( testingContext testing.TB, application *cli.Application, argv []string, options ...Option, ) Execution
Run executes with context.Background and invocation-local streams.
func RunContext ¶
func RunContext( testingContext testing.TB, ctx context.Context, application *cli.Application, argv []string, options ...Option, ) Execution
RunContext executes with an explicit caller-owned context.
func (Execution) AssertCommand ¶
AssertCommand requires the selected command's stable name.
func (Execution) AssertErrorIs ¶
AssertErrorIs requires errors.Is compatibility with target.
func (Execution) AssertExitCode ¶
AssertExitCode requires an exact portable exit status.
func (Execution) AssertStderr ¶
AssertStderr requires exact standard error.
func (Execution) AssertStdout ¶
AssertStdout requires exact standard output.
func (Execution) AssertSuccess ¶
AssertSuccess requires a nil terminal error and zero exit status.
type Option ¶
Option configures an isolated harness request.
func WithNonInteractive ¶
WithNonInteractive controls the explicit no-interaction policy.
func WithOutput ¶
func WithOutput(policy cli.OutputPolicy) Option
WithOutput selects an invocation-local output policy.