testutil

package
v0.31.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustGetTestData

func MustGetTestData[T any](file string) *T

MustGetTestData reads testdata and unmarshals it to the given type, panicking if an error occurs.

func MustUnmarshalFromFile added in v0.30.0

func MustUnmarshalFromFile(file string, out any)

MustUnmarshalFromFile reads testdata and unmarshals it to the given type, panicking if an error occurs.

func ReadFixture

func ReadFixture(filename string) []byte

ReadFixture reads testdata fixtures, panicking if an error occurs.

The prefix `./testdata/` is automatically added to the filename. Tests can 'escape' the testdata directory by prefixing the filename with `../`.

Example:

ReadFixture("foo.json") -> ./testdata/foo.json

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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