test

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build added in v0.7.0

func Build[C any](
	t *testing.T,
	build func(context.Context, *C) error,
	config *C,
	dir string,
)

func CompareErrorMessages

func CompareErrorMessages() cmp.Option

CompareErrorMessages compares errors by message.

func CompareFS added in v0.7.0

func CompareFS() cmp.Option

CompareFS compares file systems by transforming them into fstest.MapFS. It ignores the modification time and underlying data source.

func CompareFSStrict added in v0.7.0

func CompareFSStrict() cmp.Option

CompareFSStrict compares file systems by transforming them into fstest.MapFS.

func CompareLoggers

func CompareLoggers() cmp.Option

CompareLoggers compares instances of log.Logger.

func ComparePGPKeys

func ComparePGPKeys() cmp.Option

ComparePGPKeys compares PGP keys' fingerprints.

func CompareRSAPrivateKeys

func CompareRSAPrivateKeys() cmp.Option

CompareRSAPrivateKeys compares RSA private keys.

func ExportAll

func ExportAll() cmp.Option

ExportAll exports all unexported fields.

func Golden

func Golden(t *testing.T, golden, result string, filter ...PathFilter)

Golden compares the result directory to the golden directory and updates the golden directory if the UPDATE_GOLDEN environment variable is set.

func GoldenFile added in v0.7.0

func GoldenFile(t *testing.T, file string, data []byte)

func IgnoreFSMeta added in v0.7.0

func IgnoreFSMeta() cmp.Option

IgnoreFSMeta ignores the metadata of a file in a fstest.MapFS.

func IgnoreFunctions

func IgnoreFunctions() cmp.Option

IgnoreFunctions ignores all functions.

func IgnoreKeys added in v0.7.0

func IgnoreKeys(patterns ...string) cmp.Option

IgnoreKeys ignores keys in a map that match the given patterns.

func JoinYAML

func JoinYAML(s ...string) []byte

func ReadFS added in v0.7.0

func ReadFS(fsys fs.FS) fstest.MapFS

ReadFS reads the contents of a file system and returns a map of file paths to their contents.

func Source

func Source(t *testing.T, s *source.Source, makeURL func(version, asset string) string)

Source tests the given source.

func SourceWant

func SourceWant() []*source.Release

func Target

func Target(t *testing.T, tgt target.Target, makeURL func(string) string, opt ...TargetOption)

Target tests the given target.

func YAML

func YAML(s string) []byte

Types

type PathFilter

type PathFilter func(path string) bool

func Ignore

func Ignore(globs ...string) PathFilter

Ignore returns a PathFilter that ignores files matching the given globs.

type TargetOption

type TargetOption func(*targetOptions)

func WithDelay

func WithDelay(d time.Duration) TargetOption

WithDelay adds a delay between writing, updating & reading, to allow for services where the changes aren't available instantly.

func WithIgnoreRemoveNotFound

func WithIgnoreRemoveNotFound() TargetOption

WithIgnoreRemoveNotFound disables testing if removing a non-existent file returns an error.

Jump to

Keyboard shortcuts

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