match

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2020 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package match provides matchers to use with mocka for stubbing functions with custom arguments.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Priority

func Priority(m SupportedKindsMatcher) float64

Priority returns the matchers priority to be compared against

Types

type SupportedKindsMatcher

type SupportedKindsMatcher interface {
	// SupportedKinds returns the supported kinds for the matcher
	SupportedKinds() map[reflect.Kind]struct{}

	// Match return true is the match was successful; otherwise false
	Match(interface{}) bool
}

SupportedKindsMatcher describes the functionality of a custom argument matcher for mocka

func Anything

func Anything() SupportedKindsMatcher

Anything returns a new matcher that will match any value

func AnythingButNil

func AnythingButNil() SupportedKindsMatcher

AnythingButNil returns a new matcher that will match any value except nil

func ConvertibleTo

func ConvertibleTo(value interface{}) SupportedKindsMatcher

ConvertibleTo returns a new matcher that will match a value if it can be converted to the provided type

func ElementsContaining

func ElementsContaining(elements ...interface{}) SupportedKindsMatcher

ElementsContaining returns a new matcher that will match the existence of elements in a slice or array

func Empty

func Empty() SupportedKindsMatcher

Empty returns a new matcher that will match empty strings, slices, arrays, and maps

func Exactly

func Exactly(value interface{}) SupportedKindsMatcher

Exactly returns a new matcher for matching exact values with reflect.DeepEqual

func FloatGreaterThan

func FloatGreaterThan(value float64) SupportedKindsMatcher

FloatGreaterThan returns a new matcher that will match float's greater than the provided float

func FloatGreaterThanOrEqualTo

func FloatGreaterThanOrEqualTo(value float64) SupportedKindsMatcher

FloatGreaterThanOrEqualTo returns a new matcher that will match float's greater than or equal to the provided float

func FloatLessThan

func FloatLessThan(value float64) SupportedKindsMatcher

FloatLessThan returns a new matcher that will match float's less than the provided float

func FloatLessThanOrEqualTo

func FloatLessThanOrEqualTo(value float64) SupportedKindsMatcher

FloatLessThanOrEqualTo returns a new matcher that will match float's less than or equal to the provided float

func ImplementerOf

func ImplementerOf(value interface{}) SupportedKindsMatcher

ImplementerOf returns a new matcher that will match a value if it implements the provided interface

func IntGreaterThan

func IntGreaterThan(value int64) SupportedKindsMatcher

IntGreaterThan returns a new matcher that will match int's greater than the provided int

func IntGreaterThanOrEqualTo

func IntGreaterThanOrEqualTo(value int64) SupportedKindsMatcher

IntGreaterThanOrEqualTo returns a new matcher that will match int's greater than or equal to the provided int

func IntLessThan

func IntLessThan(value int64) SupportedKindsMatcher

IntLessThan returns a new matcher that will match int's less than the provided int

func IntLessThanOrEqualTo

func IntLessThanOrEqualTo(value int64) SupportedKindsMatcher

IntLessThanOrEqualTo returns a new matcher that will match int's less than or equal to the provided int

func KeysContaining

func KeysContaining(keys ...interface{}) SupportedKindsMatcher

KeysContaining returns a new matcher that will match the existence of map keys

func LengthOf

func LengthOf(length int) SupportedKindsMatcher

LengthOf returns a new matcher that will match the length of strings, slices, arrays, and maps

func Nil

Nil returns a new matcher that will only match nil

func StringContaining

func StringContaining(substring string) SupportedKindsMatcher

StringContaining returns a new matcher that will match is the substring is found

func StringPrefix

func StringPrefix(prefix string) SupportedKindsMatcher

StringPrefix returns a new matcher that will match the provided prefix

func StringSuffix

func StringSuffix(suffix string) SupportedKindsMatcher

StringSuffix returns a new matcher that will match the provided suffix

func TypeOf

func TypeOf(value string) SupportedKindsMatcher

TypeOf returns a new matcher that will match if the type names match

func UintGreaterThan

func UintGreaterThan(value uint64) SupportedKindsMatcher

UintGreaterThan returns a new matcher that will match uint's greater than the provided uint

func UintGreaterThanOrEqualTo

func UintGreaterThanOrEqualTo(value uint64) SupportedKindsMatcher

UintGreaterThanOrEqualTo returns a new matcher that will match uint's greater than or equal to the provided uint

func UintLessThan

func UintLessThan(value uint64) SupportedKindsMatcher

UintLessThan returns a new matcher that will match uint's less than the provided uint

func UintLessThanOrEqualTo

func UintLessThanOrEqualTo(value uint64) SupportedKindsMatcher

UintLessThanOrEqualTo returns a new matcher that will match uint's less than or equal to the provided uint

Jump to

Keyboard shortcuts

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