assert

package
v2.0.2-0...-0d99925 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2020 License: MIT Imports: 6 Imported by: 0

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

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

Error asserts err != nil.

func ErrorContains

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 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