utils

package
v0.0.0-...-d1ba03b Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Err

func Err[T any](_ T, err error) error

Asserts that the provided error is non-nil (using `require.Error`) and returns it, typically used in tests to verify error conditions while discarding an associated unused value of type T.

func ErrB

func ErrB[T any](_ T, err error) error

Panics if the provided error is nil, otherwise returns it; the first argument of type T is ignored and used for context in testing scenarios.

func NoErr

func NoErr[T any](v T, err error) T

Asserts that an error is nil during testing, returning the corresponding value if no error occurred.

func NoErrB

func NoErrB[T any](v T, err error) T

Panics if the provided error is non-nil, otherwise returns the given value.

func SetT

func SetT(t *testing.T)

Sets the global test instance for the package, enabling testing utilities to access the provided `testing.T` for logging and failure reporting during test execution.

Types

This section is empty.

Jump to

Keyboard shortcuts

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