Includes tools to help with concurrent testing.
DisableLogOutput redirect log's default logger to a buffer and returns it. This function should be called in an init function.
PrintIf trims the whitespace around a string encoded as byte and prints it only if not empty.
Application supports all of subcommands.Application and adds GetLog() for testing purposes.
ApplicationMock wrap both an Application and a TB. ApplicationMock implements GetOut and GetErr and adds GetLog(). GetLog() is implemented by TB.
MakeAppMock returns an initialized ApplicationMock.
TB wraps a testing.T object and adds functionality specific to command_support.
BUG: testing.TB is now a thing, so this struct should likely be renamed to reduce confusion?
MakeTB returns a fully initialized TB instance.
CheckBuffer asserts the content of os.Stdout and os.Stderr mocks.
CheckOut asserts that what was printed out Application.GetOut() matches what is expected. TODO(maruel): It doesn't matches the use case where the match must be fuzzy, for example when non-deterministic data is included in the output.
Verbose sets the current context as verbose. It immediately prints out all logs generated for this specific test case up to now and redirects the log to os.Stderr so the following log is directly output to the console.