assert

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains[T comparable](t testing.TB, s []T, v ...T)

Contains calls t.Fatalf if any value v is not present in s.

func ContainsKeys

func ContainsKeys[T comparable, A any](t testing.TB, m map[T]A, keys ...T)

ContainsKeys calls t.Fatalf if any of the specified keys are not present in m.

func ContainsVals

func ContainsVals[A, T comparable](t testing.TB, m map[A]T, vals ...T)

ContainsVals calls t.Fatalf if any of the specified vals are not present in m.

func Equal

func Equal[T comparable](t testing.TB, result, expected T)

Equal calls t.Fatalf if result != expected.

func EqualC

func EqualC[T any](t testing.TB, result Comparable[T], expected T)

EqualC calls t.Fatalf if result != expected.

func EqualMaps

func EqualMaps[K, V comparable](t testing.TB, result, expected map[K]V)

EqualMaps calls t.Fatalf if result expected do not contain the same elements.

func EqualSlices

func EqualSlices[T comparable, TS ~[]T](t testing.TB, result, expected TS)

EqualSlices calls t.Fatalf if result expected do not contain the same elements in the same order.

func Error

func Error(t testing.TB, err error)

Error calls t.Fatalf if err is nil.

func ErrorAs

func ErrorAs(t testing.TB, err error, target any)

ErrorsAs calls t.Fatalf if errors.As(err, target) fails.

func ErrorIs

func ErrorIs(t testing.TB, err, target error)

ErrorsIs calls t.Fatalf if errors.Is(err, target) fails.

func NilError

func NilError(t testing.TB, err error)

NilError calls t.Fatalf if err is not nil.

Types

type Comparable

type Comparable[T any] interface {
	// Equal should return true if t is equal to the receiver.
	Equal(t T) bool
}

A Comparable can be compared to other instances of the same type.

Jump to

Keyboard shortcuts

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