utiltest

package
v0.0.0-...-df6fa48 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesFromFile

func BytesFromFile(t *testing.T, filepath string) []byte

BytesFromFile returns file as bytes; propagates err (e.g. file does not exist) as test failure reason

func MatchSnapshot

func MatchSnapshot(t testReporter, actual any, snapshotFilepath string)

MatchSnapshot compares the actual data against a stored snapshot file.

If the snapshot file doesn't exist, it creates a new draft file (with a .draft suffix) containing the actual data and marks test failed.

If the snapshot file exists but its content differs from the actual data, it updates the draft file with the actual data, reports test failure and instructs on how to update the snapshot.

If the snapshot file exists and matches the actual data, it ensures any existing draft file is removed and the test passes for this check.

Types

This section is empty.

Jump to

Keyboard shortcuts

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