gomock

package
v0.0.0-...-5950b5c Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package gomock provides supplemental gomock types and helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Match

func Match[T any](check func(T) bool) gomock.Matcher

Match is a convenience alias for MatchFunc[T](...).

func MatchMapContains

func MatchMapContains[K comparable, V comparable](
	want map[K]V,
) gomock.Matcher

MatchMapContains returns a gomock.Matcher that asserts that a given parameter is map[K]V and contains the given key/value pairs.

func MatchMapContainsKeys

func MatchMapContainsKeys[K comparable, V any](want ...K) gomock.Matcher

MatchMapContainsKeys returns a gomock.Matcher that asserts that a given parameter is map[K]V and contains the given keys.

func MatchPrefix

func MatchPrefix(want string) gomock.Matcher

MatchPrefix returns a gomock.Matcher that asserts that a given parameter is a string and contains the given prefix.

func MatchSliceContains

func MatchSliceContains[T comparable](want ...T) gomock.Matcher

MatchSliceContains returns a gomock.Matcher that asserts that a given parameter is []T and contains the given values.

func MatchSubstring

func MatchSubstring(want string) gomock.Matcher

MatchSubstring returns a gomock.Matcher that asserts that a given parameter is a string and contains the given substring.

func MatchSuffix

func MatchSuffix(want string) gomock.Matcher

MatchSuffix returns a gomock.Matcher that asserts that a given parameter is a string and contains the given suffix.

Types

type MatchFunc

type MatchFunc[T any] func(have T) bool

MatchFunc is a gomock.Matcher that evaluates itself against a parameter.

func (MatchFunc[T]) Matches

func (f MatchFunc[T]) Matches(x any) bool

Matches indicates whether x matches f. Matches returns false if either x is not a T, or if f(x) returns false.

func (MatchFunc[T]) String

func (f MatchFunc[T]) String() string

String returns the string representation of f.

Jump to

Keyboard shortcuts

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