testutil

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: MIT Imports: 8 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertGolden

func AssertGolden(t testing.TB, got []byte, opts *AssertGoldenOptions) bool

AssertGolden asserts that got matches the contents of the golden file. If the golden file does not exist or if the environment variable UPDATE_GOLDEN is set and not empty, it writes got to the golden file first. Golden files are places in testdata/golden/<test_name>.<suffix>

func DefaultGoldenfileName

func DefaultGoldenfileName(t testing.TB, suffix string) string

func RepoRoot

func RepoRoot() string

Types

type AssertGoldenOptions

type AssertGoldenOptions struct {
	// Path to the golden file, default: testdata/golden/<test_name><suffix>.
	// When set, GoldenfileSuffix is ignored
	Goldenfile string

	// Suffix for the golden file, default: ".txt"
	GoldenfileSuffix string
}

Jump to

Keyboard shortcuts

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