Documentation ¶
Overview ¶
Package bar provides utilities for testing barista modules using a fake bar instance.
Index ¶
- func AssertNoOutput(args ...interface{})
- func Drain(wait time.Duration, formatAndArgs ...interface{}) output.Assertions
- func LatestOutput(indices ...int) output.Assertions
- func New(t require.TestingT)
- func NextOutput(formatAndArgs ...interface{}) output.Assertions
- func Run(m ...bar.Module)
- func Tick() time.Time
- type TestBar
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertNoOutput ¶
func AssertNoOutput(args ...interface{})
AssertNoOutput asserts that the bar did not output anything.
func Drain ¶
func Drain(wait time.Duration, formatAndArgs ...interface{}) output.Assertions
Drain drains all outputs until the given deadline elapses. Can be useful for working around coalescing issues where the exact number of outputs can vary based on goroutine scheduling. At least one output is expected, and the last output received before the deadline is provided for further assertions.
func LatestOutput ¶
func LatestOutput(indices ...int) output.Assertions
LatestOutput waits for an output from each of the module indices provided, and returns output assertions for the latest output. If no indices are provided, it waits for outputs from all modules. To wait for any module instead, use NextOutput().
func New ¶
New creates a new TestBar. This must be called before any modules are constructed, to ensure globals like timing.NewScheduler() are associated with the test instance.
func NextOutput ¶
func NextOutput(formatAndArgs ...interface{}) output.Assertions
NextOutput returns output assertions for the next output by the bar.