is

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2018 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllOf

func AllOf(allMatchers ...*gocrest.Matcher) *gocrest.Matcher

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

func AnyOf(allMatchers ...*gocrest.Matcher) *gocrest.Matcher

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

func Empty() *gocrest.Matcher

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

func EqualTo(expected interface{}) *gocrest.Matcher

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

func EqualToIgnoringWhitespace(expected string) (matcher *gocrest.Matcher)

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

func GreaterThan(expected interface{}) *gocrest.Matcher

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

func GreaterThanOrEqualTo(expected interface{}) *gocrest.Matcher

GreaterThanOrEqualTo is a short hand matcher for anyOf(greaterThan(x), equalTo(x)) Returns a matcher matching if actual >= expected (using deepEquals).

func LessThan

func LessThan(expected interface{}) *gocrest.Matcher

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

func LessThanOrEqualTo(expected interface{}) *gocrest.Matcher

LessThanOrEqualTo is a short hand matcher for anyOf(lessThan(x), equalTo(x)) Returns a matcher matching if actual <= expected (using deepEquals).

func MatchForPattern

func MatchForPattern(expected string) *gocrest.Matcher

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 Nil

func Nil() *gocrest.Matcher

Nil matches if the expected value is nil

func Not

func Not(matcher *gocrest.Matcher) *gocrest.Matcher

Not negates the given matcher. Returns a matcher that returns logical not of the matcher given.

func ValueContaining

func ValueContaining(expected ...interface{}) *gocrest.Matcher

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.

Jump to

Keyboard shortcuts

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