testutil

package
v0.0.0-...-f3ea40d Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertEqual

func AssertEqual[C comparable](t *testing.T, expected, actual C)

AssertEqual checks if the expected and actual are equal. Errors if not.

func AssertEqualSlice

func AssertEqualSlice[C comparable](t *testing.T, expected, actual []C)

AssertEqualSlice checks if the expected and actual slices are equal. Errors if not.

func AssertErrorMsg

func AssertErrorMsg(t *testing.T, err error, msg string)

AssertErrorMsg checks if the error is not nil.

func AssertNoDiff

func AssertNoDiff[T any](t *testing.T, expected, actual T)

func AssertNoError

func AssertNoError(t *testing.T, err error, msg ...string)

AssertNoError checks if the error is nil.

func Callers

func Callers() string

Callers prints the stack trace of everything up til the line where Callers() was invoked.

func CompareGolden

func CompareGolden(t *testing.T, data []byte, ext string)

func Contains

func Contains[C comparable](t *testing.T, haystack []C, needle C)

Contains checks if the needle is in the haystack. Errors if not.

func Diff

func Diff[T any](expected, actual T, opts ...cmp.Option) string

Diff compares two items and returns a human-readable diff string. If the items are equal, the string is empty.

func ErrorIs

func ErrorIs(t *testing.T, err, expected error)

func False

func False(t *testing.T, condition bool, msg string)

func Golden

func Golden(t *testing.T, data []byte, ext string)

func IsEqual

func IsEqual[C comparable](t *testing.T, expected, actual C)

IsEqual checks if the expected and actual are equal. Errors if not.

func IsNil

func IsNil(t *testing.T, obj any)

IsNil checks if the obj is nil. Errors if not.

func IsNotEqual

func IsNotEqual[C comparable](t *testing.T, expected, actual C)

IsNotEqual checks if the expected and actual are not equal. Errors if not.

func IsNotNil

func IsNotNil(t *testing.T, obj any)

IsNotNil checks if the obj is not nil. Errors if it is.

func NotContains

func NotContains[C comparable](t *testing.T, haystack []C, needle C)

NotContains checks if the needle is not in the haystack. Errors if it is.

func True

func True(t *testing.T, condition bool, msg string)

func UpdateGolden

func UpdateGolden(t *testing.T, data []byte, ext string)

Types

This section is empty.

Jump to

Keyboard shortcuts

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