errors

package
v0.9.0-rc5 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2024 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package errors provides useful assert functions for handling errors on tests

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Assert

func Assert(t *testing.T, err, target error, args ...interface{})

Assert err is (contains, wraps, etc) target.

func AssertAsErrorsList

func AssertAsErrorsList(t *testing.T, err error)

AssertAsErrorsList will check if the given error can be handled as an *errors.List by calling errors.As. It fails if the error fails to be an *errors.List.

func AssertErrorList

func AssertErrorList(t *testing.T, err error, targets []error)

AssertErrorList will check that the given err is an *errors.List and that all given errors on targets are contained on it using errors.Is.

func AssertIsErrors

func AssertIsErrors(t *testing.T, err error, targets []error)

AssertIsErrors will check that all target errors are contained within the given err. Usually err underlying implementation is an errors.List, but that is not enforced, it is enough that for all the target errors errors.Is returns true, so this function also works for long chains of errors.

func AssertIsKind

func AssertIsKind(t *testing.T, err error, k errors.Kind)

AssertIsKind asserts err is of kind k.

func AssertKind

func AssertKind(t *testing.T, got, want error)

AssertKind asserts that got is of same error kind as want.

Types

This section is empty.

Jump to

Keyboard shortcuts

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