testutil

package
v0.13.0 Latest Latest
Warning

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

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

Documentation

Overview

Package testutil provides utility functions for testing in Go.

Index

Constants

This section is empty.

Variables

View Source
var ErrSample = errors.New("an error")

Functions

func AssertEqual

func AssertEqual[V cmp.Ordered](t T, expected, actual V, msgAndArgs ...interface{}) bool

func AssertNil

func AssertNil(t T, object interface{}, msgAndArgs ...interface{}) bool

func AssertNotNil

func AssertNotNil(t T, object interface{}, msgAndArgs ...interface{}) bool

func AssertTrue

func AssertTrue(t T, condition bool, msgAndArgs ...interface{}) bool

func RequireError

func RequireError(t T, err error, msgAndArgs ...interface{})

func RequireErrorAs added in v0.3.0

func RequireErrorAs(t T, err error, target interface{}, msgAndArgs ...interface{})

func RequireErrorIs

func RequireErrorIs(t T, err error, target error, msgAndArgs ...interface{})

func RequireNoError

func RequireNoError(t T, err error, msgAndArgs ...interface{})

func RequireNotNil

func RequireNotNil(t T, object interface{}, msgAndArgs ...interface{})

func RequirePanics added in v0.3.0

func RequirePanics(t T, f func(), msgAndArgs ...interface{}) bool

func RequireTrue

func RequireTrue(t T, condition bool, msgAndArgs ...interface{})

Types

type T added in v0.5.0

type T interface {
	Helper()
	Errorf(format string, args ...interface{})
	Fatalf(format string, args ...interface{})
}

Jump to

Keyboard shortcuts

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