assert

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2023 License: MIT Imports: 6 Imported by: 1

Documentation

Overview

Package assert is a helper package for test assertions.

On failure, every assertion will fatal the test.

The name parameter is available in each assertion for easier debugging.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Equal

func Equal(t testing.TB, name string, exp, act interface{}, opts ...cmp.Option)

Equal asserts exp == act.

If they are not equal, it will fatal the test with a diff of the two objects.

Errors will be compared with errors.Is.

func Error added in v1.2.0

func Error(t testing.TB, name string, err error)

Error asserts err != nil.

func ErrorContains added in v1.2.0

func ErrorContains(t testing.TB, name string, err error, sub string)

ErrorContains asserts err != nil and err.Error() contains sub.

The match will be case insensitive.

func False added in v1.4.1

func False(t testing.TB, name string, act bool)

False asserts act == false.

func Success

func Success(t testing.TB, name string, err error)

Success asserts err == nil.

func True

func True(t testing.TB, name string, act bool)

True asserts act == true.

Types

This section is empty.

Jump to

Keyboard shortcuts

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