Skip to content

Equality and text ​

Equality ​

GoMock fileMatches
Equal(v), Eqequal, eqA value equal to v, by the rule above.
StrictEqual(v), EQSequalstrict, eqsA value equal to v, reading no text.
EqualIgnoreCase(s), EQIequalignorecase, eqiText equal to s, ignoring case.
IsIn(items)isinA value equal to one of items: [isIn, [10, 20]].
EqualBytes(b)equalbytesBytes equal to b, given as standard base64 in a mock file.

Text ​

GoMock fileMatches
Contain(v)containsText holding v, a list holding an item equal to v, or an object holding the key v.
HasPrefix(s), HasSuffix(s)hasprefix, hassuffixText that starts or ends with s.
GlobMatch(pattern)globText a glob matches, such as /users/*.
RegExpr(expr)regex, regexpText a Go regular expression matches.
Trim(m)trimText that m matches once its spaces are trimmed.
ToLower(m), ToUpper(m)lowercase, uppercaseText that m matches once lowered or uppercased.
Split(sep, m)splitText that m matches as the list of its parts: [split, ",", [len, 3]].

Presence ​

GoMock fileMatches
Present()presentA value that is there. [not, present] matches a header the request doesn't have.
Nil()nilNil.
Empty()emptyNil, and text, a list or an object of no items.
Truthy(), Falsy()truthy, falsyA value that reads as true, or false, as strconv.ParseBool reads text.
Anything()anythingAnything.

URLs ​

GoMock fileMatches
URLPath(glob), URLPathf, URLPathMatch(m)urlpathThe path of a URL.
RequestURI(uri)requesturiA URL whose path and query are those of uri, the parameters in any order.