testutils

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2025 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckErr

func CheckErr[V any](v V, err error) V

CheckErr can be used to simplify test code that expects no errors. Instead of:

v, err := SomeFunc()
if err != nil { .. }

we can use:

v := testutils.CheckErr(someFunc())

func CheckErr2

func CheckErr2[V any, W any](v V, w W, err error) (V, W)

CheckErr2 can be used to simplify test code that expects no errors. Instead of:

v, w, err := SomeFunc()
if err != nil { .. }

we can use:

v, w := testutils.CheckErr2(someFunc())

func DurationIsAtLeast

func DurationIsAtLeast(t testing.TB, d, minValue time.Duration)

DurationIsAtLeast verifies that the given duration is at least the given value.

func RandBytes added in v2.1.0

func RandBytes(r *rand.Rand, size int) []byte

RandBytes returns a byte slice of the given length with random data.

func RandIntInRange added in v2.1.0

func RandIntInRange(r *rand.Rand, min, max int) int

RandIntInRange returns a value in [min, max)

Types

This section is empty.

Directories

Path Synopsis
Package indenttree implements a simple text processor which parses a hierarchy defined using indentation; see Parse.
Package indenttree implements a simple text processor which parses a hierarchy defined using indentation; see Parse.

Jump to

Keyboard shortcuts

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