Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MustBeginOutputCapture ¶ added in v0.6.0
func MustBeginOutputCapture(outputSetupFuncs ...OutputSetupFunc)
MustBeginOutputCapture sets up the mock streams and starts capturing the output. It panics if another output capture is already in progress. It is the caller's responsibility to ensure mutual exclusion.
func MustEndOutputCapture ¶ added in v0.6.0
MustEndOutputCapture restores the real streams and returns the captured data. It panics if no output capture is in progress.
func ResetOutputCapture ¶ added in v0.6.0
func ResetOutputCapture()
ResetOutputCapture ensures the output capture is cleared and reset (e.g. after a panic, error or test assertion that prevents EndOutputCapture from being called). Always defer ResetOutputCapture() before using output captures.
Types ¶
type AfterSuite ¶
AfterSuite represents a method invoked after completing a test suite.
type BeforeSuite ¶
BeforeSuite describes a method invoked before starting a test suite.
type BeforeTest ¶
type BeforeTest interface {
BeforeTest(context.Context, *gomega.WithT, *gomock.Controller) context.Context
}
BeforeTest represents a method invoked before each test method in a suite.
type OutputRestoreFunc ¶ added in v0.6.0
type OutputRestoreFunc func()
OutputRestoreFunc describe a function that restores some real streams after capturing.
func OutputSetupStandard ¶ added in v0.6.0
func OutputSetupStandard(outW *os.File, errW *os.File) OutputRestoreFunc
OutputSetupStandard is a OutputSetupFunc that configures the stdout/stderr streams.
func OutputSetupTable ¶ added in v0.6.0
func OutputSetupTable(outW *os.File, _ *os.File) OutputRestoreFunc
OutputSetupTable is a OutputSetupFunc that configures the table streams (from "github.com/rodaine/table").
type OutputSetupFunc ¶ added in v0.6.0
type OutputSetupFunc func(outW *os.File, errW *os.File) OutputRestoreFunc
OutputSetupFunc describes a function that replaces some streams with mock ones for capturing.
func GetOutputSetupColor ¶ added in v0.6.0
func GetOutputSetupColor(noColor bool) OutputSetupFunc
GetOutputSetupColor returns a OutputSetupFunc that configures the color streams (from "github.com/fatih/color").