package assert

import "github.com/influxdata/influxdb/pkg/testing/assert"

Package assert provides helper functions that can be used with the standard Go testing package.

Index

Functions

func Equal

func Equal(t TestingT, got, expected interface{}, msgAndArgs ...interface{}) bool

Equal asserts that the values are equal and returns true if the assertion was successful.

func NoError

func NoError(t TestingT, err error, msgAndArgs ...interface{}) bool

NoError asserts that err is nil and returns true if the assertion was successful.

func NotEqual

func NotEqual(t TestingT, got, expected interface{}, msgAndArgs ...interface{}) bool

NotEqual asserts that the values are not equal and returns true if the assertion was successful.

func PanicsWithValue

func PanicsWithValue(t TestingT, expected interface{}, fn PanicTestFunc, msgAndArgs ...interface{}) bool

PanicsWithValue asserts that fn panics, and that the recovered panic value equals the expected panic value.

Returns true if the assertion was successful.

func ValuesAreEqual

func ValuesAreEqual(got, expected interface{}) bool

ValuesAreEqual determines if the values are equal.

func ValuesAreExactlyEqual

func ValuesAreExactlyEqual(got, expected interface{}) bool

ValuesAreExactlyEqual determines if the values are equal and their types are the same.

Types

type PanicTestFunc

type PanicTestFunc func()

PanicTestFunc defines a function that is called to determine whether a panic occurs.

type TestingT

type TestingT interface {
	Errorf(format string, args ...interface{})
}

Source Files

assertions.go doc.go helper.go

Version
v1.12.0 (latest)
Published
Apr 8, 2025
Platform
linux/amd64
Imports
3 packages
Last checked
2 days ago

Tools for package owners.