Documentation
¶
Index ¶
- func CanExecute(v cmdr.Executor)
- func HasSubcommands(v cmdr.Subcommander)
- type Terminal
- type TestOutput
- func (out TestOutput) HasLineMatching(s string) bool
- func (out TestOutput) Lines() []string
- func (out TestOutput) LinesContaining(s string) []string
- func (out TestOutput) MostSimilarLineTo(s string) (winner string, index int, goodMatch bool)
- func (out TestOutput) NumLines() int
- func (out TestOutput) ShouldHaveExactLine(s string)
- func (out TestOutput) ShouldHaveLineContaining(s string)
- func (out TestOutput) ShouldHaveNumLines(expected int)
- func (out TestOutput) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanExecute ¶
CanExecute fails the build if the thing passed does not implement the CanExecute interface.
func HasSubcommands ¶
func HasSubcommands(v cmdr.Subcommander)
HasSubcommands fails the build if the thing passed does not implement the HasSubcommands interface.
Types ¶
type Terminal ¶
type Terminal struct { *cmdr.CLI Stdout, Stderr, Combined TestOutput History []string T *testing.T }
Terminal is a test harness for the CLI, providing easy introspection into its inputs and outputs.
func (*Terminal) PrintFailureSummary ¶
func (t *Terminal) PrintFailureSummary()
func (*Terminal) RunCommand ¶
RunCommand takes a command line, turns it into args, and passes it to a CLI which is pre-populated with a fresh *cli.Sous command, OutWriter and ErrWriter, both mapped to Outputs for interrogation.
Note: This cannot cope with arguments containing spaces, even if they are surrounded by quotes. We should add this feature if we need it.
type TestOutput ¶
Output allows inspection of output streams from the Terminal.
func (TestOutput) HasLineMatching ¶
func (out TestOutput) HasLineMatching(s string) bool
func (TestOutput) Lines ¶
func (out TestOutput) Lines() []string
func (TestOutput) LinesContaining ¶
func (out TestOutput) LinesContaining(s string) []string
func (TestOutput) MostSimilarLineTo ¶
func (out TestOutput) MostSimilarLineTo(s string) ( winner string, index int, goodMatch bool)
MostSimilarLineTo returns the most similar line in the output to the given string, if any of them have a JaroWinkler score >0.1. It returns the string (or empty), the index of that line, and a bool indicating if the score was greater than 0.1
func (TestOutput) NumLines ¶
func (out TestOutput) NumLines() int
func (TestOutput) ShouldHaveExactLine ¶
func (out TestOutput) ShouldHaveExactLine(s string)
func (TestOutput) ShouldHaveLineContaining ¶
func (out TestOutput) ShouldHaveLineContaining(s string)
func (TestOutput) ShouldHaveNumLines ¶
func (out TestOutput) ShouldHaveNumLines(expected int)
func (TestOutput) String ¶
func (out TestOutput) String() string