matchers

package
v1.53.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2022 License: Apache-2.0, BSD-2-Clause, MIT, + 1 more Imports: 14 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BeAlreadyExistsError added in v1.12.0

func BeAlreadyExistsError() types.GomegaMatcher

BeAlreadyExistsError checks if error is AlreadyExists.

func BeBadRequestError

func BeBadRequestError() types.GomegaMatcher

BeBadRequestError checks if error is BadRequest.

func BeCacheError added in v1.20.0

func BeCacheError() types.GomegaMatcher

BeCacheError checks if error is a CacheError.

func BeComparableTo added in v1.52.0

func BeComparableTo(expected interface{}, opts ...cmp.Option) types.GomegaMatcher

BeComparableTo uses gocmp.Equal to compare. You can pass cmp.Option as options. It is an error for actual and expected to be nil. Use BeNil() instead.

func BeForbiddenError

func BeForbiddenError() types.GomegaMatcher

BeForbiddenError checks if error is Forbidden.

func BeInternalServerError added in v1.17.0

func BeInternalServerError() types.GomegaMatcher

BeInternalServerError checks if error is a InternalServerError.

func BeInvalidError added in v1.17.0

func BeInvalidError() types.GomegaMatcher

BeInvalidError checks if error is an InvalidError.

func BeMissingKindError added in v1.13.0

func BeMissingKindError() types.GomegaMatcher

BeMissingKindError checks if error is a MissingKindError.

func BeNoMatchError added in v1.12.0

func BeNoMatchError() types.GomegaMatcher

BeNoMatchError checks if error is a NoMatchError.

func BeNotFoundError

func BeNotFoundError() types.GomegaMatcher

BeNotFoundError checks if error is NotFound.

func ConsistOfFields

func ConsistOfFields(fields ...gstruct.Fields) types.GomegaMatcher

ConsistOfFields succeeds if actual matches all selected fields. Actual must be an array, slice or map. For maps, ConsistOfFields matches against the map's values. Actual's elements must be pointers.

func DeepDerivativeEqual

func DeepDerivativeEqual(expected interface{}) types.GomegaMatcher

DeepDerivativeEqual is similar to DeepEqual except that unset fields in actual are ignored (not compared). This allows us to focus on the fields that matter to the semantic comparison.

func DeepEqual

func DeepEqual(expected interface{}) types.GomegaMatcher

DeepEqual returns a Gomega matcher which checks whether the expected object is deeply equal with the object it is being compared against.

func HaveFields

func HaveFields(fields gstruct.Fields) types.GomegaMatcher

HaveFields succeeds if actual is a pointer and has a specific fields. Ignores extra elements or fields.

Types

type BeComparableToMatcher added in v1.52.0

type BeComparableToMatcher struct {
	Expected interface{}
	Options  cmp.Options
}

BeComparableToMatcher allows comparisons with additional comparison options

func (*BeComparableToMatcher) FailureMessage added in v1.52.0

func (matcher *BeComparableToMatcher) FailureMessage(actual interface{}) (message string)

FailureMessage returns the message of the failure

func (*BeComparableToMatcher) Match added in v1.52.0

func (matcher *BeComparableToMatcher) Match(actual interface{}) (success bool, matchErr error)

Match compares the actual with the expected value

func (*BeComparableToMatcher) NegatedFailureMessage added in v1.52.0

func (matcher *BeComparableToMatcher) NegatedFailureMessage(actual interface{}) (message string)

NegatedFailureMessage returns the negated message of the failure

Jump to

Keyboard shortcuts

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