Documentation ¶
Overview ¶
Package testutil contains helpers for working with commands in tests.
Package testutil provides common functionality for tests across the CLI.
NOTE: this package is only for generic utilities that don't have dependencies on other packages in the CLI. For utilities specific to another CLI package foo, create a foo/test package.
Index ¶
- func AnyLineContainsAll(output string, substrs ...string) bool
- func ContainsAll(s string, substrs ...string) bool
- func ContainsAny(s string, substrs ...string) bool
- func ContainsRow(s string, fields ...string) (bool, error)
- func CreateTestCommand() *cobra.Command
- func Execute(cmd *cobra.Command, args []string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AnyLineContainsAll ¶
AnyLineContainsAll validates that some line of the output contains all the provided substrings.
func ContainsAll ¶
ContainsAll validates all provided substrs are contained in s.
func ContainsAny ¶
ContainsAny validates any of the provided substrs is contained in s.
func ContainsRow ¶
ContainsRow validates that all provided fields appear, in order, in a tab-separated row in s.
func CreateTestCommand ¶
CreateTestCommand create a Cobra command suitable for use in tests.
Types ¶
This section is empty.