testerrors

package
v1.19.1-rc.1 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertEqual

func AssertEqual(t *testing.T, expected, actual error, msgAndArgs ...interface{})

AssertEqual fails the test if the actual error does not match the expected error. Similar to sigs.k8s.io/cli-utils/pkg/testutil.AssertEqual, but automatically wraps non-nil expected errors with testutil.EqualError to allow matching by type and string value.

This works around an issue with status.Error that breaks errors.Is(), which only compares the error code. Using testerrors.Equal, the assertion is more strict.

func EqualError

func EqualError(err error) error

EqualError returns an error with an Is(error)bool function that matches any error with the same type and string value as the supplied error.

Use with AssertEqual to handle error comparisons.

Types

This section is empty.

Jump to

Keyboard shortcuts

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