assertions

package module
v0.0.0-...-a1a86f4 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2024 License: MIT Imports: 3 Imported by: 0

README

assertions

A minimal dependency test assertion library in the style of testify/require

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Equal

func Equal[T any](tb testing.TB, expected, input T)

Equal asserts that 2 values of the same type are equal using reflect.DeepEqual

func ErrorsMatch

func ErrorsMatch(tb testing.TB, expected, input error)

ErrorsMatch asserts that the input and expected error either are both nil or both have the same string returned by Error. This is to facilitate table driven test with a single expected error field.

func MapsMatch

func MapsMatch[K comparable, E any, T ~map[K]E](tb testing.TB, expected, input T)

MapsMatch asserts that both expected and input have the same members regardless of order elements in expected and input are compared using reflect.DeepEqual. Failing results will only print the non-matching elements

func NoError

func NoError(tb testing.TB, input error)

func SlicesMatch

func SlicesMatch[E any, T ~[]E](tb testing.TB, expected, input T)

SlicesMatch asserts that both expected and input have the same members regardless of order elements in expected and input are compared using reflect.DeepEqual. Failing results will only print the non-matching elements

func Within

func Within[T cmp.Ordered](tb testing.TB, minT, maxT, input T)

Within asserts that input is within the range [minT, maxT] The assertion will pass while input is >= minT and input is <= maxT

Types

This section is empty.

Jump to

Keyboard shortcuts

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