assert

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2020 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Equal

func Equal(t Tester, want, got interface{})

Equal fails the test if two values are not equal.

func FieldError added in v0.17.0

func FieldError(t testing.TB, err error, fieldName string, want *errors.Error)

FieldError ensures that given error contains the exact match of a single field error, tested by its type (.Is method call). To test that no error was found for a given field name, use `nil` as the match value.

func IsErr added in v0.19.0

func IsErr(t testing.TB, want, got error)

IsErr is a convenient helper that checks if the errors are a match and prints out the difference if not as well as failing the assertion.

func Nil

func Nil(t Tester, value interface{})

Nil fails the test if given value is not nil.

func Panics

func Panics(t Tester, fn func())

Panics will run given function and recover any panic. It will fail the test if given function call did not panic.

Types

type Tester added in v0.19.0

type Tester interface {
	Helper()
	Fatal(...interface{})
	Fatalf(string, ...interface{})
}

Tester is the minimal subset of testing.TB needed to run most assert commands

Jump to

Keyboard shortcuts

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