fixturez

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 3, 2024 License: MIT Imports: 14 Imported by: 0

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

func MustEndOutputCapture() (string, string)

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.

func RunSuite

func RunSuite(t *testing.T, suite any)

RunSuite runs the test suite.

Types

type AfterSuite

type AfterSuite interface {
	AfterSuite(context.Context, *gomega.WithT)
}

AfterSuite represents a method invoked after completing a test suite.

type AfterTest

type AfterTest interface {
	AfterTest(context.Context, *gomega.WithT)
}

AfterTest represents a method invoked after each test method in a suite.

type BeforeSuite

type BeforeSuite interface {
	BeforeSuite(context.Context, *gomega.WithT) context.Context
}

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").

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL