assert

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package assert provides utility functions for testing which help assert certain conditions are met.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllEnumValuesAreValid added in v0.3.0

func AllEnumValuesAreValid(t *testing.T, filePath, enumName string, validate func(string) error)

AllEnumValuesAreValid checks if all enum values are valid as defined by a supplied validation function. The enum (distinguished by enumName) is read from a Go source file at the specified filePath.

func Equal

func Equal(t *testing.T, expected, actual any) bool

Equal fails the test if the expected and actual values are not equal.

func Error

func Error(t *testing.T, err error) bool

Error fails the test if the error is nil.

func False

func False(t *testing.T, actual bool) bool

False fails the test if the actual value is not false.

func Len

func Len(t *testing.T, v any, length int) bool

Len fails the test if the value is not of the expected length.

func NoError

func NoError(t *testing.T, err error) bool

NoError fails the test if the error is not nil.

func NotEmpty

func NotEmpty(t *testing.T, v any) bool

NotEmpty fails the test if the value is empty.

func Require

func Require(t *testing.T, isPassing bool)

Require fails the test if the provided boolean is false. It should be used in conjunction with assert functions. Example:

assert.Require(t, assert.AssertError(t, err))

func True

func True(t *testing.T, actual bool) bool

True fails the test if the actual value is not true.

Types

This section is empty.

Jump to

Keyboard shortcuts

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