testutil

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2025 License: Apache-2.0 Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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