condassert

package
v0.0.0-...-2bb223d Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorIf

func ErrorIf(a ErrorAssertions, wantErr bool, err error, msgAndArgs ...any) bool

ErrorIf asserts that err is not nil if wantErr is true, or nil if wantErr is false.

func NilIf

func NilIf(a NilAssertions, wantNil bool, object any, msgAndArgs ...any) bool

NilIf asserts that the specified object is nil if wantNil is true, or not nil if wantNil is false.

func PanicsIf

func PanicsIf(a PanicsAssertions, wantPanic bool, f assert.PanicTestFunc, msgAndArgs ...any) bool

PanicsIf asserts that function panics if wantPanic is true, or does not panic if wantPanic is false.

func ZeroIf

func ZeroIf(a ZeroAssertions, wantNil bool, i any, msgAndArgs ...any) bool

ZeroIf asserts that i is the zero value for its type if wantZero is true, or not if wantZero is true.

Types

type ErrorAssertions

type ErrorAssertions interface {
	Error(err error, msgAndArgs ...any) bool
	NoError(err error, msgAndArgs ...any) bool
}

ErrorAssertions checks errors.

type NilAssertions

type NilAssertions interface {
	Nil(object any, msgAndArgs ...any) bool
	NotNil(object any, msgAndArgs ...any) bool
}

NilAssertions checks nilness.

type PanicsAssertions

type PanicsAssertions interface {
	Panics(f assert.PanicTestFunc, msgAndArgs ...any) bool
	NotPanics(f assert.PanicTestFunc, msgAndArgs ...any) bool
}

PanicsAssertions checks panics.

type ZeroAssertions

type ZeroAssertions interface {
	Zero(i any, msgAndArgs ...any) bool
	NotZero(i any, msgAndArgs ...any) bool
}

ZeroAssertions checks against zero values.

Jump to

Keyboard shortcuts

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