testutil

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: MIT Imports: 8 Imported by: 0

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