testhelpers

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package testhelpers provides testing utilities for golden file testing.

Index

Constants

This section is empty.

Variables

View Source
var Update = os.Getenv("UPDATE_GOLDEN") == "1"

Update returns true if UPDATE_GOLDEN environment variable is set. Use: UPDATE_GOLDEN=1 go test ./... to update golden files.

Functions

func AssertGolden

func AssertGolden(t *testing.T, name string, actual string)

AssertGolden compares actual output to a golden file. If -update flag is set, it updates the golden file instead.

func AssertGoldenNormalized

func AssertGoldenNormalized(t *testing.T, name string, actual string)

AssertGoldenNormalized compares output with normalized line endings.

func CreateTempDir

func CreateTempDir(t *testing.T, files map[string]string) string

CreateTempDir creates a temporary directory with optional files.

func CreateTempFile

func CreateTempFile(t *testing.T, name, content string) string

CreateTempFile creates a single temporary file with content.

func GoldenDir

func GoldenDir() string

GoldenDir returns the path to the testdata/golden directory.

func GoldenFile

func GoldenFile(name string) string

GoldenFile returns the full path to a golden file.

Types

This section is empty.

Jump to

Keyboard shortcuts

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