Documentation
¶
Index ¶
- func AllOf(allMatchers ...*gocrest.Matcher) *gocrest.Matcher
- func AnyOf(allMatchers ...*gocrest.Matcher) *gocrest.Matcher
- func Empty() *gocrest.Matcher
- func EqualTo(expected interface{}) *gocrest.Matcher
- func EqualToIgnoringWhitespace(expected string) (matcher *gocrest.Matcher)
- func False() *gocrest.Matcher
- func GreaterThan(expected interface{}) *gocrest.Matcher
- func GreaterThanOrEqualTo(expected interface{}) *gocrest.Matcher
- func LessThan(expected interface{}) *gocrest.Matcher
- func LessThanOrEqualTo(expected interface{}) *gocrest.Matcher
- func MatchForPattern(expected string) *gocrest.Matcher
- func Nil() *gocrest.Matcher
- func Not(matcher *gocrest.Matcher) *gocrest.Matcher
- func True() *gocrest.Matcher
- func ValueContaining(expected ...interface{}) *gocrest.Matcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllOf ¶
AllOf takes some matchers and checks if all the matchers return true. Returns a matcher that performs the the test on the input matchers.
func AnyOf ¶
AnyOf takes some matchers and checks if at least one of the matchers return true. Returns a matcher that performs the the test on the input matchers.
func Empty ¶
Empty matches if the actual is "empty". 'string' values are empty if they are "", maps, arrays and slices are empty if len(actual) is 0. Pointers and interfaces are empty when nil. Other types (int, float, bool) will cause the function to panic. Returns a matcher that evaluates true if actual is "empty".
func EqualTo ¶
EqualTo checks if two values are equal. Uses DeepEqual (could be slow). Returns a matcher that will return true if two values are equal.
func EqualToIgnoringWhitespace ¶ added in v1.0.1
EqualToIgnoringWhitespace tests whether two strings have identical content without any whitespace comparison. For example:
"a bc" is EqualToIgnoringWhitespace when compared with "a b c" "a b c" is EqualToIgnoringWhitespace when compared with "a \nb \tc" "ab\tc" is EqualToIgnoringWhitespace when compared with "a \nb \tc" .. and so on.
func GreaterThan ¶
GreaterThan matcher compares two values that are numeric or string values, and when called returns true if actual > expected. Strings are compared lexicographically with '>'. The matcher will always return false for unknown types. Actual and expected types must be the same underlying type, or the function will panic. Returns a matcher that checks if actual is greater than expected.
func GreaterThanOrEqualTo ¶
GreaterThanOrEqualTo is a short hand matcher for anyOf(greaterThan(x), equalTo(x)) Returns a matcher matching if actual >= expected (using deepEquals).
func LessThan ¶
LessThan matcher compares two values that are numeric or string values, and when called returns true if actual < expected. Strings are compared lexicographically with '<'. The matcher will always return false for unknown types. Actual and expected types must be the same underlying type, or the function will panic. Returns a matcher that checks if actual is greater than expected.
func LessThanOrEqualTo ¶
LessThanOrEqualTo is a short hand matcher for anyOf(lessThan(x), equalTo(x)) Returns a matcher matching if actual <= expected (using deepEquals).
func MatchForPattern ¶
MatchForPattern matches if actual string matches the expected regex String provided must be a valid for compilation with regexp.Compile. Returns a matcher that uses the expected for a regex to match the actual value.
func Not ¶
Not negates the given matcher. Returns a matcher that returns logical not of the matcher given.
func ValueContaining ¶
ValueContaining finds if x is contained in y. Acts like "ContainsAll", all elements given must be present in actual. If "expected" is an array or slice, we assume that actual is the same type. assertThat([]T, has.ValueContaining(a,b,c)) is also valid if variadic a,b,c are all type T. For maps, the expected must also be a map or a variadic and matches if both maps contain all key,values in expected or all variadic values respectively. For string, behaves like strings.Contains. Will panic if types cannot be converted correctly. Returns the Matcher that returns true if found.
Types ¶
This section is empty.