is

package
v0.14.7 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package is contains a simple assertion library for the fun/ensure testing framework. The package name is simple and chosen mostly to namespace a collection of operations for readability effects.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type That

type That fn.Future[[]string]

That is the root type for the assertion helpers in this package. Implementations return nil for no-errors, and one or more error messages for failing assertions..

func All added in v0.10.4

func All(ops ...That) That

All combines a collection of that expressions. All expressions are run in order, and the error are aggregated. Nil is.That expressions are reported as errors.

func And added in v0.10.4

func And(ops ...That) That

And combines a collection of That expression. All constituent expressions are run in order until one fails, at which point the operation aborts.

func Contained

func Contained[T comparable](item T, sl []T) That

Contained asserts that the slice (sl) has at least one element equal to the item.

func EqualTo

func EqualTo[T comparable](a, b T) That

EqualTo asserts that two comparable values are equal to eachother.

func Error

func Error(e error) That

Error asserts that the error object is not nil.

func ErrorIs

func ErrorIs(er, tr error) That

ErrorIs asserts that the error (er) is, or unwraps to, the target (tr) error.

func False

func False(c bool) That

False asserts that the value is false.

func Nil

func Nil(val any) That

Nil asserts that the value is nil. Uses reflection unlike the other assertions.

func NilPtr added in v0.10.4

func NilPtr[T any](val *T) That

NilPtr asserts that the pointer is nil.

func NotContained

func NotContained[T comparable](item T, sl []T) That

NotContained asserts that the slice (sl) has no elements that are equal to the item.

func NotEqualTo

func NotEqualTo[T comparable](a, b T) That

NotEqualTo asserts that two comparable values are not equal to eachother.

func NotError

func NotError(e error) That

NotError asserts that the error object is nil.

func NotErrorIs

func NotErrorIs(er, tr error) That

NotErrorIs asserts that the error (er) is not, and does not unwrap to, the target (tr) error.

func NotNil

func NotNil(val any) That

NotNil asserts that the value is not nil.

func NotNilPtr added in v0.10.4

func NotNilPtr[T any](val *T) That

NotNilPtr asserts that the pointer is not nil.

func NotPanic

func NotPanic(op func()) That

NotPanic asserts that the function (op) does not panic when executed.

func NotSubstring

func NotSubstring(s, substr string) That

NotSubstring asserts that the string (s) does not contain the substring (substr.)

func NotType

func NotType[T any](v any) That

NotType asserts that the value v is not of type T.

func NotZero

func NotZero[T comparable](val T) That

NotZero asserts that the comparable value is not equal to the zero value for the type T.

func Panic

func Panic(op func()) That

Panic asserts that the function (op) panics when executed.

func Substring

func Substring(s, substr string) That

Substring asserts that the string (s) contains the substring (substr).

func True

func True(c bool) That

True asserts that the value is true.

func Type

func Type[T any](v any) That

Type asserts that value v is of type T.

func Zero

func Zero[T comparable](val T) That

Zero asserts that the comparable value is equal to the zero value for the type T.

Jump to

Keyboard shortcuts

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