testutil

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2025 License: Apache-2.0 Imports: 4 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[T cmp.Ordered](t *testing.T, expected, actual T, msgAndArgs ...interface{}) bool

func AssertNil

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

func AssertNotNil

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

func AssertTrue

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

func RequireError

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

func RequireErrorAs added in v0.3.0

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

func RequireErrorIs

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

func RequireNoError

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

func RequireNotNil

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

func RequirePanics added in v0.3.0

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

func RequireTrue

func RequireTrue(t *testing.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