barista.run: barista.run/testing/bar Index | Files

package bar

import "barista.run/testing/bar"

Package bar provides utilities for testing barista modules using a fake bar instance.

Index

Package Files

bar.go

func AssertNoOutput Uses

func AssertNoOutput(args ...interface{})

AssertNoOutput asserts that the bar did not output anything.

func Drain Uses

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 Uses

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 Uses

func New(t require.TestingT)

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 Uses

func NextOutput(formatAndArgs ...interface{}) output.Assertions

NextOutput returns output assertions for the next output by the bar.

func Run Uses

func Run(m ...bar.Module)

Run starts the TestBar with the given modules.

func Tick Uses

func Tick() time.Time

Tick calls timing.NextTick() under the covers, allowing some tests that don't need fine grained scheduling control to treat timing's test mode as an implementation detail.

type TestBar Uses

type TestBar struct {
    require.TestingT
    // contains filtered or unexported fields
}

TestBar represents a minimal wrapper around core.ModuleSet that simulates a bar for testing purposes.

Package bar imports 10 packages (graph). Updated 2018-12-31. Refresh now. Tools for package owners.