assertions

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ascending added in v0.2.5

func Ascending[O constraints.Ordered](slice []O) (s string)

func AscendingCmp added in v0.6.3

func AscendingCmp[A any](slice []A, compare func(a, b A) int) (s string)

func AscendingFunc added in v0.2.5

func AscendingFunc[A any](slice []A, less func(a, b A) bool) (s string)

func AscendingLess added in v0.2.5

func AscendingLess[L interfaces.LessFunc[L]](slice []L) (s string)

func Between added in v0.4.0

func Between[O constraints.Ordered](lower, val, upper O) (s string)

func BetweenExclusive added in v0.4.0

func BetweenExclusive[O constraints.Ordered](lower, val, upper O) (s string)

func Caller

func Caller() string

func Close added in v0.6.7

func Close(c io.Closer) (s string)

func Contains

func Contains[C any](i C, c interfaces.ContainsFunc[C]) (s string)

func ContainsSubset added in v0.6.1

func ContainsSubset[C any](elements []C, container interfaces.ContainsFunc[C]) (s string)

func Descending added in v0.2.5

func Descending[O constraints.Ordered](slice []O) (s string)

func DescendingCmp added in v0.6.3

func DescendingCmp[A any](slice []A, compare func(a, b A) int) (s string)

func DescendingFunc added in v0.2.5

func DescendingFunc[A any](slice []A, less func(a, b A) bool) (s string)

func DescendingLess added in v0.2.5

func DescendingLess[L interfaces.LessFunc[L]](slice []L) (s string)

func DirExists added in v0.2.5

func DirExists(directory string) (s string)

func DirExistsFS added in v0.4.0

func DirExistsFS(system fs.FS, directory string) (s string)

func DirMode added in v1.9.1

func DirMode(path string, permissions fs.FileMode) (s string)

func DirModeFS added in v1.8.0

func DirModeFS(system fs.FS, path string, permissions fs.FileMode) (s string)

func DirNotExists added in v0.2.5

func DirNotExists(directory string) (s string)

func DirNotExistsFS added in v0.4.0

func DirNotExistsFS(system fs.FS, directory string) (s string)

func Empty added in v0.4.0

func Empty(e interfaces.EmptyFunc) (s string)

func Eq

func Eq[A any](exp, val A, opts ...cmp.Option) (s string)

func EqError

func EqError(err error, msg string) (s string)

func EqFunc

func EqFunc[A any](exp, val A, eq func(a, b A) bool) (s string)

func EqJSON

func EqJSON(exp, val string) (s string)

func EqOp added in v0.2.4

func EqOp[C comparable](exp, val C) (s string)

func EqSliceFunc

func EqSliceFunc[A, B any](exp []B, val []A, eq func(a A, b B) bool) (s string)

func Equal added in v0.4.0

func Equal[E interfaces.EqualFunc[E]](exp, val E) (s string)

func Error

func Error(err error) (s string)

func ErrorAs added in v1.11.0

func ErrorAs[E error, Target *E](err error, target Target) (s string)

func ErrorContains added in v0.5.0

func ErrorContains(err error, sub string) (s string)

func ErrorIs

func ErrorIs(err error, target error) (s string)

func False

func False(condition bool) (s string)

func FileContains added in v0.2.5

func FileContains(file, content string) (s string)

func FileContainsFS added in v0.4.0

func FileContainsFS(system fs.FS, file, content string) (s string)

func FileExists added in v0.2.5

func FileExists(file string) (s string)

func FileExistsFS added in v0.4.0

func FileExistsFS(system fs.FS, file string) (s string)

func FileMode added in v0.2.5

func FileMode(path string, permissions fs.FileMode) (s string)

func FileModeFS added in v0.4.0

func FileModeFS(system fs.FS, path string, permissions fs.FileMode) (s string)

func FileNotExists added in v0.2.5

func FileNotExists(file string) (s string)

func FileNotExistsFS added in v0.4.0

func FileNotExistsFS(system fs.FS, file string) (s string)

func FilePathValid added in v0.2.5

func FilePathValid(path string) (s string)

func Greater

func Greater[O constraints.Ordered](exp, val O) (s string)

func GreaterEq

func GreaterEq[O constraints.Ordered](exp, val O) (s string)

func InDelta

func InDelta[N interfaces.Number](a, b, delta N) (s string)

func InDeltaSlice

func InDeltaSlice[N interfaces.Number](a, b []N, delta N) (s string)

func Length added in v0.4.0

func Length(n int, length interfaces.LengthFunc) (s string)

func Less

func Less[O constraints.Ordered](exp, val O) (s string)

func LessEq

func LessEq[O constraints.Ordered](exp, val O) (s string)

func Lesser

func Lesser[L interfaces.LessFunc[L]](exp, val L) (s string)

func MapContainsKey added in v0.6.0

func MapContainsKey[M ~map[K]V, K comparable, V any](m M, key K) (s string)

func MapContainsKeys added in v0.2.5

func MapContainsKeys[M ~map[K]V, K comparable, V any](m M, keys []K) (s string)

func MapContainsValue added in v1.7.2

func MapContainsValue[M ~map[K]V, K comparable, V any](m M, val V, opts cmp.Options) (s string)

func MapContainsValueEqual added in v1.7.2

func MapContainsValueEqual[M ~map[K]V, K comparable, V interfaces.EqualFunc[V]](m M, val V) (s string)

func MapContainsValueFunc added in v1.7.2

func MapContainsValueFunc[M ~map[K]V, K comparable, V any](m M, val V, eq func(V, V) bool) (s string)

func MapContainsValues added in v0.2.5

func MapContainsValues[M ~map[K]V, K comparable, V any](m M, vals []V, opts cmp.Options) (s string)

func MapContainsValuesEqual added in v0.4.0

func MapContainsValuesEqual[M ~map[K]V, K comparable, V interfaces.EqualFunc[V]](m M, vals []V) (s string)

func MapContainsValuesFunc added in v0.2.5

func MapContainsValuesFunc[M ~map[K]V, K comparable, V any](m M, vals []V, eq func(V, V) bool) (s string)

func MapEmpty

func MapEmpty[M ~map[K]V, K comparable, V any](m M) (s string)

func MapEq

func MapEq[M1, M2 interfaces.Map[K, V], K comparable, V any](exp M1, val M2, opts cmp.Options) (s string)

func MapEqFunc

func MapEqFunc[M1, M2 interfaces.Map[K, V], K comparable, V any](exp M1, val M2, eq func(V, V) bool) (s string)

func MapEqOp added in v1.10.0

func MapEqOp[M interfaces.Map[K, V], K, V comparable](exp, val M) (s string)

func MapEqual added in v0.4.0

func MapEqual[M interfaces.MapEqualFunc[K, V], K comparable, V interfaces.EqualFunc[V]](exp, val M) (s string)

func MapLen

func MapLen[M ~map[K]V, K comparable, V any](n int, m M) (s string)

func MapNotContainsKey added in v0.6.0

func MapNotContainsKey[M ~map[K]V, K comparable, V any](m M, key K) (s string)

func MapNotContainsKeys added in v0.4.6

func MapNotContainsKeys[M ~map[K]V, K comparable, V any](m M, keys []K) (s string)

func MapNotContainsValue added in v1.7.2

func MapNotContainsValue[M ~map[K]V, K comparable, V any](m M, val V, opts cmp.Options) (s string)

func MapNotContainsValueEqual added in v1.7.2

func MapNotContainsValueEqual[M ~map[K]V, K comparable, V interfaces.EqualFunc[V]](m M, val V) (s string)

func MapNotContainsValueFunc added in v1.7.2

func MapNotContainsValueFunc[M ~map[K]V, K comparable, V any](m M, val V, eq func(V, V) bool) (s string)

func MapNotContainsValues added in v0.4.6

func MapNotContainsValues[M ~map[K]V, K comparable, V any](m M, vals []V, opts cmp.Options) (s string)

func MapNotContainsValuesEqual added in v0.4.6

func MapNotContainsValuesEqual[M ~map[K]V, K comparable, V interfaces.EqualFunc[V]](m M, vals []V) (s string)

func MapNotContainsValuesFunc added in v0.4.6

func MapNotContainsValuesFunc[M ~map[K]V, K comparable, V any](m M, vals []V, eq func(V, V) bool) (s string)

func MapNotEmpty added in v0.4.0

func MapNotEmpty[M ~map[K]V, K comparable, V any](m M) (s string)

func Max added in v0.6.3

func Max[A any, C interfaces.MaxFunc[A]](expect A, collection C, opts ...cmp.Option) (s string)

func Min added in v0.6.3

func Min[A any, C interfaces.MinFunc[A]](expect A, collection C, opts ...cmp.Option) (s string)

func Negative added in v0.2.5

func Negative[N interfaces.Number](value N) (s string)

func Nil

func Nil(a any) (s string)

func NoError

func NoError(err error) (s string)

func NonNegative added in v0.4.0

func NonNegative[N interfaces.Number](value N) (s string)

func NonPositive added in v0.4.0

func NonPositive[N interfaces.Number](value N) (s string)

func NonZero added in v0.2.5

func NonZero[N interfaces.Number](value N) (s string)

func NotContains added in v0.4.0

func NotContains[C any](i C, c interfaces.ContainsFunc[C]) (s string)

func NotEmpty added in v0.4.0

func NotEmpty(e interfaces.EmptyFunc) (s string)

func NotEq

func NotEq[A any](exp, val A, opts ...cmp.Option) (s string)

func NotEqFunc

func NotEqFunc[A any](exp, val A, eq func(a, b A) bool) (s string)

func NotEqOp added in v0.2.5

func NotEqOp[C comparable](exp, val C) (s string)

func NotEqual added in v0.4.0

func NotEqual[E interfaces.EqualFunc[E]](exp, val E) (s string)

func NotNil

func NotNil(a any) (s string)

func One added in v0.3.1

func One[N interfaces.Number](value N) (s string)

func Positive added in v0.2.5

func Positive[N interfaces.Number](value N) (s string)

func RegexMatch added in v0.2.5

func RegexMatch(re *regexp.Regexp, target string) (s string)

func RegexpCompiles added in v0.3.0

func RegexpCompiles(expr string) (s string)

func RegexpCompilesPOSIX added in v0.3.0

func RegexpCompilesPOSIX(expr string) (s string)

func Size added in v0.4.0

func Size(n int, size interfaces.SizeFunc) (s string)

func SliceContains added in v0.4.0

func SliceContains[A any](slice []A, item A, opts ...cmp.Option) (s string)

func SliceContainsAll added in v0.4.0

func SliceContainsAll[A any](slice, items []A, opts ...cmp.Option) (s string)

func SliceContainsAllEqual added in v1.12.0

func SliceContainsAllEqual[E interfaces.EqualFunc[E]](slice, items []E) (s string)

func SliceContainsAllFunc added in v1.12.0

func SliceContainsAllFunc[A, B any](slice []A, items []B, eq func(a A, b B) bool) (s string)

func SliceContainsAllOp added in v1.12.0

func SliceContainsAllOp[C comparable](slice, items []C) (s string)

func SliceContainsEqual added in v0.4.0

func SliceContainsEqual[E interfaces.EqualFunc[E]](slice []E, item E) (s string)

func SliceContainsFunc added in v0.4.0

func SliceContainsFunc[A, B any](slice []A, item B, eq func(a A, b B) bool) (s string)

func SliceContainsOp added in v0.4.0

func SliceContainsOp[C comparable](slice []C, item C) (s string)

func SliceContainsSubset added in v0.4.1

func SliceContainsSubset[A any](slice, items []A, opts ...cmp.Option) (s string)

func SliceContainsSubsetEqual added in v1.12.0

func SliceContainsSubsetEqual[E interfaces.EqualFunc[E]](slice, items []E) (s string)

func SliceContainsSubsetFunc added in v1.12.0

func SliceContainsSubsetFunc[A, B any](slice []A, items []B, eq func(a A, b B) bool) (s string)

func SliceContainsSubsetOp added in v1.12.0

func SliceContainsSubsetOp[C comparable](slice, items []C) (s string)

func SliceEmpty added in v0.4.0

func SliceEmpty[A any](slice []A) (s string)

func SliceEqOp added in v1.10.0

func SliceEqOp[A comparable, S ~[]A](exp, val S) (s string)

func SliceEqual added in v0.4.0

func SliceEqual[E interfaces.EqualFunc[E]](exp, val []E) (s string)

func SliceLen added in v0.4.0

func SliceLen[A any](n int, slice []A) (s string)

func SliceNotContains added in v0.4.0

func SliceNotContains[A any](slice []A, item A, opts ...cmp.Option) (s string)

func SliceNotContainsFunc added in v0.6.3

func SliceNotContainsFunc[A, B any](slice []A, item B, eq func(a A, b B) bool) (s string)

func SliceNotEmpty added in v0.4.0

func SliceNotEmpty[A any](slice []A) (s string)

func StrContains added in v0.3.0

func StrContains(str, sub string) (s string)

func StrContainsAny added in v0.3.0

func StrContainsAny(str, chars string) (s string)

func StrContainsFields added in v0.3.0

func StrContainsFields(str string, fields []string) (s string)

func StrContainsFold added in v0.3.0

func StrContainsFold(str, sub string) (s string)

func StrCount added in v0.3.0

func StrCount(str, sub string, exp int) (s string)

func StrEqFold added in v0.3.0

func StrEqFold(exp, val string) (s string)

func StrHasPrefix added in v0.3.0

func StrHasPrefix(prefix, str string) (s string)

func StrHasSuffix added in v0.3.0

func StrHasSuffix(suffix, str string) (s string)

func StrNotContains added in v0.3.0

func StrNotContains(str, sub string) (s string)

func StrNotContainsAny added in v0.3.0

func StrNotContainsAny(str, chars string) (s string)

func StrNotContainsFold added in v0.3.0

func StrNotContainsFold(str, sub string) (s string)

func StrNotEqFold added in v0.3.0

func StrNotEqFold(exp, val string) (s string)

func StrNotHasPrefix added in v0.3.0

func StrNotHasPrefix(prefix, str string) (s string)

func StrNotHasSuffix added in v0.3.0

func StrNotHasSuffix(suffix, str string) (s string)

func StructEqual added in v0.6.2

func StructEqual[E interfaces.CopyEqual[E]](original E, tweaks []Tweak[E]) (s string)

StructEqual will apply each Tweak and assert E.Equal captures the modification.

func True

func True(condition bool) (s string)

func UUIDv4 added in v0.3.1

func UUIDv4(id string) (s string)

func Unreachable added in v0.2.8

func Unreachable() (s string)

func ValidJSON added in v0.6.1

func ValidJSON(input string) (s string)

func ValidJSONBytes added in v0.6.1

func ValidJSONBytes(input []byte) (s string)

func Wait added in v0.5.0

func Wait(wc *wait.Constraint) (s string)

func Zero added in v0.2.5

func Zero[N interfaces.Number](value N) (s string)

Types

type Tweak added in v0.6.2

type Tweak[E interfaces.CopyEqual[E]] struct {
	Field string
	Apply interfaces.TweakFunc[E]
}

Jump to

Keyboard shortcuts

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