Documentation
¶
Overview ¶
Package testhelpers provides testing utilities for golden file testing.
Index ¶
- Variables
- func AssertGolden(t *testing.T, name string, actual string)
- func AssertGoldenNormalized(t *testing.T, name string, actual string)
- func CreateTempDir(t *testing.T, files map[string]string) string
- func CreateTempFile(t *testing.T, name, content string) string
- func GoldenDir() string
- func GoldenFile(name string) string
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 ¶
AssertGolden compares actual output to a golden file. If -update flag is set, it updates the golden file instead.
func AssertGoldenNormalized ¶
AssertGoldenNormalized compares output with normalized line endings.
func CreateTempDir ¶
CreateTempDir creates a temporary directory with optional files.
func CreateTempFile ¶
CreateTempFile creates a single temporary file with content.
func GoldenDir ¶
func GoldenDir() string
GoldenDir returns the path to the testdata/golden directory.
func GoldenFile ¶
GoldenFile returns the full path to a golden file.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.