Documentation
¶
Index ¶
- func AssertCoverage(t *testing.T, area string)
- func Expand(data []byte, paths Paths) []byte
- func RegisterRunner(area, runner string, kinds ...string)
- func Run(m *testing.M) int
- func UpdatePack(root string) error
- func VerifyPack(root string) error
- func Walk(t *testing.T, area, runner string, run func(*testing.T, Case))
- func WalkKinds(t *testing.T, area, runner string, kinds []string, run func(*testing.T, Case))
- type Case
- func (c Case) CompareJSON(t *testing.T, name string, actual any, paths Paths, mode GoldenMode)
- func (c Case) Decode(t *testing.T, name string, destination any)
- func (c Case) DecodePaths(t *testing.T, name string, destination any, paths Paths)
- func (c Case) Metadata(t *testing.T) Metadata
- func (c Case) Read(t *testing.T, name string, paths Paths) []byte
- type GoldenMode
- type Metadata
- type Paths
- type WarningFields
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertCoverage ¶
AssertCoverage validates the layout and common metadata of every case in an area. Subsystem tests remain responsible for interpreting kind-specific data.
func Expand ¶
Expand replaces ${HOME}, ${WORKDIR}, and ${CONFIG_DIR} in one non-recursive pass. Other placeholders are fixture content and remain unchanged.
func RegisterRunner ¶
RegisterRunner declares the exact fixture kinds executed by a named test runner. A zero-kind registration is dormant and owns no fixture cases.
func Run ¶
Run executes a package test binary and verifies its registered fixture runners before returning the process exit code.
func UpdatePack ¶
UpdatePack regenerates the language-neutral fixture archive and manifest.
func VerifyPack ¶
VerifyPack compares the committed fixture archive and manifest without mutating either the fixtures or their generated artifacts.
Types ¶
type Case ¶
func (Case) CompareJSON ¶
CompareJSON structurally compares actual with a JSON golden. GoldenUpdate atomically replaces the golden with deterministic, placeholder-normalized JSON before performing the same read-only comparison.
func (Case) DecodePaths ¶
DecodePaths loads sorted JSON, expands placeholders in JSON string values, and decodes it into destination.
type GoldenMode ¶
type GoldenMode uint8
GoldenMode makes golden-file mutation an explicit call-site decision.
const ( GoldenReadOnly GoldenMode = iota GoldenUpdate )
type Paths ¶
Paths contains the only values that portable fixtures may substitute. Values are normalized to slash-separated paths before use.
type WarningFields ¶
type WarningFields struct {
Code string `json:"code"`
Source string `json:"source"`
Path string `json:"path"`
Line int `json:"line"`
}
WarningFields is the stable fixture projection of a warning. Human-readable messages are deliberately excluded from golden compatibility.
func StableWarnings ¶
func StableWarnings(values []warning.Warning) []WarningFields
StableWarnings removes warning prose while retaining stable structured fields in producer order. Paths use slash separators, and an empty input projects to [] rather than null.