testutil

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package testutil holds helpers shared by the tests.

Index

Constants

View Source
const CmdTimeout = 30 * time.Millisecond

CmdTimeout is how long RunCmds waits for each command. Tool results arrive in microseconds; slow ticks (cursor blink, debounce) are dropped.

Variables

This section is empty.

Functions

func Golden

func Golden(t testing.TB, id, name, got string)

Golden compares got with testdata/<id>/<name>.golden, or rewrites it when Updating() is true.

func Path

func Path(t testing.TB, parts ...string) string

Path returns testdata/<parts...> relative to the module root.

func ReadInput

func ReadInput(t testing.TB, id, name string) string

ReadInput reads testdata/<id>/<name>.in.

func Root

func Root(t testing.TB) string

Root returns the module root (the directory holding go.mod).

func RunCmds

func RunCmds(cmd tea.Cmd, update func(tea.Msg) tea.Cmd)

RunCmds runs cmd and hands every message to update, which may return more commands. It expands tea.BatchMsg. Commands that take longer than CmdTimeout are abandoned.

func Updating

func Updating() bool

Updating reports whether golden files must be regenerated: with -update in a single package or with UPDATE_GOLDEN=1 (used by make golden-update, because -update breaks packages that do not import testutil).

Types

This section is empty.

Jump to

Keyboard shortcuts

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