assert

package
v1.11.5 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: MIT Imports: 3 Imported by: 1

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

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{})
}

Jump to

Keyboard shortcuts

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