golden

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package golden provides shared golden file testing logic for assert and require packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatMsgAndArgs

func FormatMsgAndArgs(msgAndArgs ...any) string

FormatMsgAndArgs formats the message and arguments like fmt.Sprintf.

Types

type Result

type Result struct {
	Passed bool
	Error  error
}

Result contains the outcome of a golden file comparison.

func Check

func Check(t TestingT, got string, opts *termitest.Options, msgAndArgs ...any) Result

Check compares got against the golden file for the current test. If the golden file doesn't exist, it creates it automatically. Returns a Result indicating success or failure.

type TestingT

type TestingT interface {
	Errorf(format string, args ...any)
	Helper()
	Name() string
}

TestingT is the minimal interface required for assertions. It is satisfied by *testing.T and *testing.B.

Jump to

Keyboard shortcuts

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