Documentation
¶
Overview ¶
Package matcher provides value matchers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Callback ¶
type Callback func() Matcher
Callback matches by calling a function.
type EmptyMatcher ¶
type EmptyMatcher struct{}
EmptyMatcher checks whether the value is empty.
func (EmptyMatcher) Expected ¶
func (EmptyMatcher) Expected() string
Expected returns the expectation.
func (EmptyMatcher) Match ¶
func (EmptyMatcher) Match(actual interface{}) (bool, error)
Match determines if the actual is expected.
type ExactMatcher ¶
type ExactMatcher struct {
// contains filtered or unexported fields
}
ExactMatcher matches by exact string.
func Exact ¶
func Exact(expected interface{}) ExactMatcher
Exact matches two objects by their exact values.
func Exactf ¶
func Exactf(expected string, args ...interface{}) ExactMatcher
Exactf matches two strings by the formatted expectation.
func (ExactMatcher) Expected ¶
func (m ExactMatcher) Expected() string
Expected returns the expectation.
func (ExactMatcher) Match ¶
func (m ExactMatcher) Match(actual interface{}) (bool, error)
Match determines if the actual is expected.
type JSONMatcher ¶
type JSONMatcher struct {
// contains filtered or unexported fields
}
JSONMatcher matches by json with <ignore-diff> support.
func JSON ¶
func JSON(expected interface{}) JSONMatcher
JSON matches two json strings with <ignore-diff> support.
func (JSONMatcher) Expected ¶
func (m JSONMatcher) Expected() string
Expected returns the expectation.
func (JSONMatcher) Match ¶
func (m JSONMatcher) Match(actual interface{}) (bool, error)
Match determines if the actual is expected.
type LenMatcher ¶
type LenMatcher struct {
// contains filtered or unexported fields
}
LenMatcher matches by the length of the value.
func (LenMatcher) Expected ¶
func (m LenMatcher) Expected() string
Expected returns the expectation.
func (LenMatcher) Match ¶
func (m LenMatcher) Match(actual interface{}) (_ bool, err error)
Match determines if the actual is expected.
type NotEmptyMatcher ¶
type NotEmptyMatcher struct{}
NotEmptyMatcher checks whether the value is not empty.
func IsNotEmpty ¶
func IsNotEmpty() NotEmptyMatcher
IsNotEmpty checks whether the value is not empty.
func (NotEmptyMatcher) Expected ¶
func (NotEmptyMatcher) Expected() string
Expected returns the expectation.
func (NotEmptyMatcher) Match ¶
func (NotEmptyMatcher) Match(actual interface{}) (bool, error)
Match determines if the actual is expected.
type RegexMatcher ¶
type RegexMatcher struct {
// contains filtered or unexported fields
}
RegexMatcher matches by regex.
func Regex ¶
func Regex(regexp *regexp.Regexp) RegexMatcher
Regex matches two strings by using regex.
func RegexPattern ¶
func RegexPattern(pattern string) RegexMatcher
RegexPattern matches two strings by using regex.
func (RegexMatcher) Expected ¶
func (m RegexMatcher) Expected() string
Expected returns the expectation.
func (RegexMatcher) Match ¶
func (m RegexMatcher) Match(actual interface{}) (bool, error)
Match determines if the actual is expected.