Documentation
¶
Overview ¶
Package appcmdtesting contains test utilities for appcmd.
Index ¶
- func Run(t *testing.T, newCommand func(use string) *appcmd.Command, ...)
- type RunOption
- func WithArgs(args ...string) RunOption
- func WithEnv(newEnv func(use string) map[string]string) RunOption
- func WithExpectedExitCode(expectedExitCode int) RunOption
- func WithExpectedExitCodes(expectedExitCodes ...int) RunOption
- func WithExpectedStderr(expectedStderr string) RunOption
- func WithExpectedStderrPartials(expectedStderrPartials ...string) RunOption
- func WithExpectedStdout(expectedStdout string) RunOption
- func WithStderr(stderr io.Writer) RunOption
- func WithStdin(stdin io.Reader) RunOption
- func WithStdout(stdout io.Writer) RunOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type RunOption ¶
type RunOption func(*runOptions)
RunOption is a new option for Run.
func WithEnv ¶
WithEnv will attach the given environment variable map created by newEnv.
The default is no environment variables.
func WithExpectedExitCode ¶
WithExpectedExitCode will result in Run checking that the exit code is the expected value.
By default, Run will check that the exit code is 0.
func WithExpectedExitCodes ¶
WithExpectedExitCodes will result in Run checking that the exit code is one of the expected values.
By default, Run will check that the exit code is 0.
func WithExpectedStderr ¶
WithExpectedStdout will result in an error if the stderr does not exactly equal the given string.
Note that this can be called with empty, which will result in Run verifying that the stderr is empty.
func WithExpectedStderrPartials ¶
WithExpectedStderrPartials will result in Run checking if all the given strings are contained within stderr.
Note that this can be called with empty, which will result in Run verifying that the stderr is empty.
func WithExpectedStdout ¶
WithExpectedStdout will result in an error if the stdout does not exactly equal the given string.
Note that this can be called with empty, which will result in Run verifying that the stdout is empty.
func WithStderr ¶
WithStdout will attach the given stderr to write to.
func WithStdout ¶
WithStdout will attach the given stdout to write to.