test

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2025 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Assert

func Assert(expected interface{}, result interface{}, test *testing.T)

Takes in an expected & result object, of any type. Asserts that their Go syntax representations (%#v) are the same. Prints a message on success if the ENV var DEBUG is set to "true". Fails the test if this is not true.

func AssertContains

func AssertContains[T any](slice []T, item T, test *testing.T)

Takes in an expected slice of objects and an 'item' object, of any type Asserts that the 'item' is contained within the slice. Prints a message on success if the ENV var DEBUG is set to "true". Fails the test if this is not true.

func Debug added in v0.16.0

func Debug() bool

Checks if the test is running in Debug mode, i.e. has been run with the ENV var DEBUG=true. To do this, either first run `export DEBUG=true`, and then run the test command, or do it all at once with `DEBUG=true go test -v ./test“

func Fail

func Fail(expected interface{}, result interface{}, test *testing.T)

Fails a test with a formatted message showing the expected vs. result. (These are both printed in %#v form)

func FlattenJSON

func FlattenJSON(json string) string

Flattens a given json string, removing all tabs, spaces and newlines

Types

This section is empty.

Jump to

Keyboard shortcuts

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