Documentation ¶
Overview ¶
Package subcommandstest includes tools to help with concurrent testing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DisableLogOutput ¶
DisableLogOutput redirect log's default logger to a buffer and returns it. This function should be called in an init function.
Types ¶
type Application ¶
type Application interface { subcommands.Application GetLog() *log.Logger }
Application supports all of subcommands.Application and adds GetLog() for testing purposes.
type ApplicationMock ¶
type ApplicationMock struct { subcommands.Application *TB }
ApplicationMock wrap both an Application and a TB. ApplicationMock implements GetOut and GetErr and adds GetLog(). GetLog() is implemented by TB.
func MakeAppMock ¶
func MakeAppMock(t *testing.T, a subcommands.Application) *ApplicationMock
MakeAppMock returns an initialized ApplicationMock.
func (*ApplicationMock) GetErr ¶
func (a *ApplicationMock) GetErr() io.Writer
GetErr implements subcommands.Application.
func (*ApplicationMock) GetOut ¶
func (a *ApplicationMock) GetOut() io.Writer
GetOut implements subcommands.Application.
type TB ¶
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?
func (*TB) CheckBuffer ¶
CheckBuffer asserts the content of os.Stdout and os.Stderr mocks.