testhelper

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2021 License: Apache-2.0 Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Error added in v0.8.0

func Error() error

Error returns an internal error for testing

func HijackStandardStreams added in v0.8.0

func HijackStandardStreams(stdin, stdout, stderr *os.File, do func())

func NewAlwaysErrFS added in v0.8.0

func NewAlwaysErrFS(err error) fs.FS

NewAlwaysErrFS creates an fs.FS that always fail at Open() call with provided err

if err is nil, fs.ErrInvalid is returned by default

func NewAlwaysFailReader added in v0.8.0

func NewAlwaysFailReader(err error) io.Reader

NewAlwaysFailReader creates an reader already fail on Read() call with provided err

if err is nil, an io.ErrUnexpectedEOF is returned by default

func TestFixtures

func TestFixtures(
	t *testing.T,
	dir string,
	createTestSpec func() interface{},
	createExpected func() interface{},
	check func(t *testing.T, spec interface{}, exp interface{}),
)

TestFixtures run tests using multi-doc yaml file

# first doc is the test spec some_args: ... spec:

a: b

--- # second doc is the expected result c: d

Types

This section is empty.

Jump to

Keyboard shortcuts

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