assert

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Equal

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

Equal asserts that two objects are equal.

assert.Equal(t, 123, 123)

Pointer variable equality is determined based on the equality of the referenced values (as opposed to the memory addresses). Function equality cannot be determined and will always fail.

func Fail

func Fail(t TestingT, failureMessage string, msgAndArgs ...interface{}) bool

Fail reports a failure through

func JSONEq

func JSONEq(t TestingT, expected string, actual string, msgAndArgs ...interface{}) bool

JSONEq asserts that two JSON strings are equivalent.

assert.JSONEq(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`)

func NotNil

func NotNil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool

NotNil asserts that the specified object is not nil.

assert.NotNil(t, err)

func ObjectsAreEqual

func ObjectsAreEqual(expected, actual interface{}) bool

ObjectsAreEqual determines if two objects are considered equal.

This function does no assertion of any kind.

Types

type TestingT

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

TestingT is an interface wrapper around *testing.T

Jump to

Keyboard shortcuts

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