golden

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package golden provides utilities for golden file testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Golden

type Golden struct {
	// contains filtered or unexported fields
}

Golden provides utilities for comparing test output with golden files.

func New

func New(t *testing.T, fixture string) *Golden

New creates a new Golden instance for the given test and fixture name. The fixture name is used to organize golden files into subdirectories.

func (*Golden) Assert

func (g *Golden) Assert(name string, got []byte)

Assert compares the given output with the golden file. If the --update flag is set, it updates the golden file instead.

func (*Golden) AssertString

func (g *Golden) AssertString(name string, got string)

AssertString is a convenience wrapper around Assert for string output.

func (*Golden) Exists

func (g *Golden) Exists(name string) bool

Exists checks if a golden file exists for the given name.

func (*Golden) Path

func (g *Golden) Path(name string) string

Path returns the path to a golden file for the given name.

Jump to

Keyboard shortcuts

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