assert

package
v0.0.0-...-fc2a63e Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2021 License: BSD-3-Clause, MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckStringDivergence

func CheckStringDivergence(t *testing.T, expOut, actOut string)

Very useful when debugging outputs that don't match up.

func RunTestAndCaptureStdout

func RunTestAndCaptureStdout(
	fn actionFn,
) (out []*exec.Output, retErr []error, result bool, debug string)

For some tests we need to capture stdout for validation with expected output. Code here is based on various similar code snippets found by googling StackOverflow and the like.

Types

type ExpectedError

type ExpectedError struct {
	// contains filtered or unexported fields
}

func NewExpectedError

func NewExpectedError(expect string) *ExpectedError

func (*ExpectedError) Matches

func (e *ExpectedError) Matches(t *testing.T, actual error)

type ExpectedMessages

type ExpectedMessages struct {
	// contains filtered or unexported fields
}

func NewExpectedMessages

func NewExpectedMessages(expect ...string) *ExpectedMessages

func (*ExpectedMessages) ContainedIn

func (e *ExpectedMessages) ContainedIn(t *testing.T, actual string)

func (*ExpectedMessages) ContainedInAny

func (e *ExpectedMessages) ContainedInAny(t *testing.T, actual []string)

Check each expected message appears in at least one of the actual strings.

func (*ExpectedMessages) ContainedInOrderIn

func (e *ExpectedMessages) ContainedInOrderIn(t *testing.T, actual string)

func (*ExpectedMessages) NotContainedIn

func (e *ExpectedMessages) NotContainedIn(t *testing.T, actual string)

Jump to

Keyboard shortcuts

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