Documentation ¶
Index ¶
- func AllOf(matchers ...*base.Matcher) *base.Matcher
- func AnyOf(matchers ...*base.Matcher) *base.Matcher
- func Anything() *base.Matcher
- func Applying(function interface{}, name string) func(*base.Matcher) *base.Matcher
- func DeepEqualTo(expected interface{}) *base.Matcher
- func EqualTo(expected interface{}) *base.Matcher
- func False() *base.Matcher
- func GreaterThan(expected interface{}) *base.Matcher
- func GreaterThanOrEqualTo(expected interface{}) *base.Matcher
- func Is(matcher *base.Matcher) *base.Matcher
- func LessThan(expected interface{}) *base.Matcher
- func LessThanOrEqualTo(expected interface{}) *base.Matcher
- func Nil() *base.Matcher
- func NonNil() *base.Matcher
- func Not(matcher *base.Matcher) *base.Matcher
- func NotEqualTo(expected interface{}) *base.Matcher
- func PanicWhenApplying(functionOrMatcher interface{}, name string) *base.Matcher
- func True() *base.Matcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllOf ¶
Returns a short-circuiting Matcher that matches whenever all of the given matchers match a given input value. If any component matcher fails to match an input value, later matchers are not attempted.
func AnyOf ¶
Returns a short-circuiting Matcher that matches whenever all of the given matchers match a given input value. If any component matcher fails to match an input value, later matchers are not attempted.
func Applying ¶
Returns a function that composes the given function with a Matcher, such as:
ToLength := Composer(func(s string) int { return len(s) }, "ToLength")
And then:
HasLengthThree := ToLength(Is(EqualTo(3))) HasLengthThree.Match("no").Matched() // false HasLengthThree.Match("yes").Matched() // true
The given function must be able to accept a single argument and return a single argument.
func DeepEqualTo ¶
Returns a Matcher that checks if the actual value is (deeply) equal to the given expected value, using reflect.DeepEqual.
For an equality test equivalent to `==`, see the `hamcrest/comparison` package.
func EqualTo ¶
Returns a matcher that matches values that are equal to the given expected value, using the equality (==) operator.
func GreaterThan ¶
Returns a matcher that matches values that are greater-than the given expected value, using the greater-than (<) operator.
func GreaterThanOrEqualTo ¶
Returns a matcher that matches values that are greater-than-or-equal-to the given expected value, using the greater-than-or-equal-to (>=) operator.
func LessThan ¶
Returns a matcher that matches values that are less-than the given expected value, using the less-than (<) operator.
func LessThanOrEqualTo ¶
Returns a matcher that matches values that are less-than-or-equal-to the given expected value, using the less-than-or-equal-to (<=) operator.
func Nil ¶
Returns a Matcher that matches if the actual value is nil or the nil value of its type. (Note that this is *not* equivalent to DeeplyEqualTo(nil).)
func NonNil ¶
Returns a Matcher that matches if the actual value is neither nil nor the nil value of its type. (Note that this is *not* equivalent to Not(DeeplyEqualTo(nil)).)
func Not ¶
Returns a Matcher that decorates another matcher and only matches when the underlying matcher does not match (and vice versa).
func NotEqualTo ¶
Returns a matcher that matches values that are not equal to the given expected value, using the inequality (!=) operator.
func PanicWhenApplying ¶
Returns a Matcher that matches on values that cause the given functionOrMatcher to panic.
functionOrMatcher should either be a function that accepts one parameter or a Matcher.
Types ¶
This section is empty.