mockutil

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Context

func Context() gomock.Matcher

func Eq

func Eq(want interface{}, opts ...cmp.Option) eqMatcher

Eq is similar to gomock.Eq but uses go-cmp, accepts options and returns a human-readable report of the differences between the compared values.

func EquateNearlySameTime

func EquateNearlySameTime() cmp.Option

EquateNearlySameTime returns a cmp.Comparer option that determines two non-zero time.Time values to be equal if they are within one second of one another. It uses cmpopts.EquateApproxtime.

func Func

func Func[P any](description string, check func(P) error) *funcMatcher[P]

Func tests a function parameter P received by a mock provided a check function.

csvc.EXPECT().UpdateTransfer(
	mockutil.Context(),
	transferID,
	mockutil.Func(
		"should update X",
		func(updater persistence.TransferUpdater) error {
			_, err := updater(&goacontents.Transfer{})
			return err
		},
	),
)

func Recent added in v0.6.0

func Recent() eqMatcher

Recent returns a matcher that evaluates to true if the parameter passed to the mock function is a time.Time representing a clock reading from within the last second.

Types

This section is empty.

Jump to

Keyboard shortcuts

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