Documentation ¶
Overview ¶
Package fixturez provides a test suite framework and various utilities for capturing output.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MustBeginOutputCapture ¶
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 ¶
MustEndOutputCapture restores the real streams and returns the captured data. It panics if no output capture is in progress.
func ResetOutputCapture ¶
func ResetOutputCapture()
ResetOutputCapture ensures the output capture is cleared and reset (e.g. after a panic, error or test assertion that prevents MustEndOutputCapture 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 ¶
type OutputRestoreFunc func()
OutputRestoreFunc describe a function that restores some real streams after capturing.
func OutputSetupRodaineTable ¶
func OutputSetupRodaineTable(outW *os.File, _ *os.File) OutputRestoreFunc
OutputSetupRodaineTable is a OutputSetupFunc that configures the table streams (from "github.com/rodaine/table").
func OutputSetupStandard ¶
func OutputSetupStandard(outW *os.File, errW *os.File) OutputRestoreFunc
OutputSetupStandard is a OutputSetupFunc that configures the stdout/stderr streams.
type OutputSetupFunc ¶
type OutputSetupFunc func(outW *os.File, errW *os.File) OutputRestoreFunc
OutputSetupFunc describes a function that replaces some streams with mock ones for capturing.
func GetOutputSetupFatihColor ¶
func GetOutputSetupFatihColor(noColor bool) OutputSetupFunc
GetOutputSetupFatihColor returns a OutputSetupFunc that configures the color streams (from "github.com/fatih/color").