All matchers
The matchers of the match package, by their Go name and their name in mock files, which ignores case. Equalf, StrictEqualf, EqualIgnoreCasef and Containf take their expected value as a format and its arguments. A blank mock-file name means Go only. Each row links to the page that explains it.
| Go | Mock file | Page |
|---|---|---|
Equal(v), Eq | equal, eq | Equality and text |
StrictEqual(v), EQS | equalstrict, eqs | Equality and text |
EqualIgnoreCase(s), EQI | equalignorecase, eqi | Equality and text |
IsIn(items) | isin | Equality and text |
EqualBytes(b) | equalbytes | Equality and text |
Contain(v) | contains | Equality and text |
HasPrefix(s), HasSuffix(s) | hasprefix, hassuffix | Equality and text |
GlobMatch(pattern) | glob | Equality and text |
RegExpr(expr) | regex, regexp | Equality and text |
Trim(m) | trim | Equality and text |
ToLower(m), ToUpper(m) | lowercase, uppercase | Equality and text |
Split(sep, m) | split | Equality and text |
Present() | present | Equality and text |
Nil() | nil | Equality and text |
Empty() | empty | Equality and text |
Truthy(), Falsy() | truthy, falsy | Equality and text |
Anything() | anything | Equality and text |
URLPath(glob), URLPathf, URLPathMatch(m) | urlpath | Equality and text |
RequestURI(uri) | requesturi | Equality and text |
GreaterThan(n), GT | greater, gt | Numbers, dates and times |
GreaterThanOrEqual(n), GTE | greatereq, gte | Numbers, dates and times |
LessThan(n) | less, lt | Numbers, dates and times |
LessThanOrEqual(n), LTE | lesseq, lte | Numbers, dates and times |
Before(t), BeforeNow() | before | Numbers, dates and times |
After(t), AfterNow() | after | Numbers, dates and times |
EqualDateTime(t), EqualDateTimeNow() | equaldatetime, eqdt | Numbers, dates and times |
Len(n) | len, length | Lists and objects |
Each(m) | each | Lists and objects |
Some(m) | some | Lists and objects |
Item(i, m) | item | Lists and objects |
ItemsMatch(items) | itemsmatch | Lists and objects |
ItemsMatch with matchers | hasexactly | Lists and objects |
HasKey(path) | haskey | Lists and objects |
JSONPath(path, m), Field | jsonpath, field | JSON and XML |
JWT(m) | jwt | JSON and XML |
SignedJWT(keys, m) | signedjwt | JSON and XML |
EqualJSON(doc, opts...), EQJ | equaljson, eqj | JSON and XML |
JSONSchema(schema, opts...) | jsonschema | JSON and XML |
EqualXML(doc, opts...), EQX | equalxml, eqx | JSON and XML |
XPath(expr, m, opts...) | xpath | JSON and XML |
All(ms...) | all | Combining |
Any(ms...) | any | Combining |
Both(a, b), Either(a, b), XOR(a, b) | both, either, xor | Combining |
Not(m) | not | Combining |
Function(fn), Predicate(fn) | Combining | |
Peek(m, action) | Combining |