bar

package
v0.0.0-...-c936f35 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

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

Index

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

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

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

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

func Run

func Run(m ...bar.Module)

Run starts the TestBar with the given modules.

func Tick

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.

Types

type TestBar

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.

Jump to

Keyboard shortcuts

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