Liking cljdoc? Tell your friends :D

matcher-combinators.matchers


absentclj/s

Value-position matcher for maps that matches when containing map doesn't have the key pointing to this matcher.

Value-position matcher for maps that matches when containing map doesn't have the key pointing to this matcher.
sourceraw docstring

embedsclj/s

(embeds expected)

Matcher that will match when the map contains some of the same key/values as the expected map.

Matcher that will match when the map contains some of the same key/values as
the `expected` map.
sourceraw docstring

equalsclj/s

(equals expected)

Matcher that will match when the given value is exactly the same as the expected.

Matcher that will match when the given value is exactly the same as the
`expected`.
sourceraw docstring

in-any-orderclj/s

(in-any-order expected)

Matcher that will match when the given a list that is the same as the expected list but with elements in a different order.

Similar to Midje's (just expected :in-any-order)

Matcher that will match when the given a list that is the same as the
`expected` list but with elements in a different order.

Similar to Midje's `(just expected :in-any-order)`
sourceraw docstring

lookup-matcherclj/s

(lookup-matcher value pred->matcher-overrides)

Internal use only. Iterates through pred->matcher-overrides and returns the value (a matcher) bound to the first pred that returns true for value. If no override is found, returns the default matcher for value.

The legacy API called for a map of type->matcher, which is still supported by wrapping types in (instance? type %) predicates.

Internal use only. Iterates through pred->matcher-overrides and
returns the value (a matcher) bound to the first pred that returns
true for value. If no override is found, returns the default matcher
for value.

The legacy API called for a map of type->matcher, which is still
supported by wrapping types in (instance? type %) predicates.
sourceraw docstring

match-withclj/s

(match-with overrides value)

Given a vector (or map) of overrides, returns the appropriate matcher for value (with value wrapped). If no matcher for value is found in overrides, uses the default: embeds for maps regex for regular expressions equals for everything else

If value is a collection, recursively applies match-with to its nested values, ignoring nested values that are already wrapped in matchers.

NOTE that each nested match-with creates a new context, and nested contexts do not inherit the overrides of their parent contexts.

Given a vector (or map) of overrides, returns the appropriate matcher
for value (with value wrapped). If no matcher for value is found in
overrides, uses the default:
  embeds for maps
  regex  for regular expressions
  equals for everything else

If value is a collection, recursively applies match-with to its nested
values, ignoring nested values that are already wrapped in matchers.

NOTE that each nested match-with creates a new context, and nested contexts
do not inherit the overrides of their parent contexts.
sourceraw docstring

matcher-forclj/s

(matcher-for expected)
(matcher-for expected overrides)

Returns the type-specific matcher object for an expected value. This is used internally to support the match-with matcher, and is also useful for discovery when you want to know which Matcher type is associated to a value.

Adds :matcher-object? metadata to the returned matcher so that other functions can differentiate between matcher objects and objects that happen to implement the Matcher protocol (which should be all other objects).

Returns the type-specific matcher object for an expected
value. This is used internally to support the match-with matcher,
and is also useful for discovery when you want to know which Matcher
type is associated to a value.

Adds :matcher-object? metadata to the returned matcher so that
other functions can differentiate between matcher objects and
objects that happen to implement the Matcher protocol (which should
be all other objects).
sourceraw docstring

predclj/s

(pred pred)

Matcher that will match when pred of the actual value returns true.

Matcher that will match when `pred` of the actual value returns true.
sourceraw docstring

prefixclj/s

(prefix expected)

Matcher that will match when provided a (ordered) prefix of the expected list.

Similar to Midje's (embeds expected)

Matcher that will match when provided a (ordered) prefix of the `expected`
list.

Similar to Midje's `(embeds expected)`
sourceraw docstring

regexclj/s

(regex expected)

Matcher that will match when given value matches the expected regular expression.

Matcher that will match when given value matches the `expected` regular expression.
sourceraw docstring

set-embedsclj/s

(set-embeds expected)

Matches a set in the way (embeds some-set) would, but accepts sequences as the expected matcher argument, allowing one to use matchers with the same submatcher appearing more than once.

Matches a set in the way `(embeds some-set)` would, but accepts sequences
as the expected matcher argument, allowing one to use matchers with the same
submatcher appearing more than once.
sourceraw docstring

set-equalsclj/s

(set-equals expected)

Matches a set in the way (equals some-set) would, but accepts sequences as the expected matcher argument, allowing one to use matchers with the same submatcher appearing more than once.

Matches a set in the way `(equals some-set)` would, but accepts sequences as
the expected matcher argument, allowing one to use matchers with the same
submatcher appearing more than once.
sourceraw docstring

within-deltaclj/s

(within-delta delta)
(within-delta delta expected)

Given delta and expected, returns a Matcher that will match when the actual value is within delta of expected. Given only delta, returns a function to be used in the context of match-with, e.g.

(is (match? (m/match-with [number? (m/within-delta 0.01M)] <expected>) <actual>))

Given `delta` and `expected`, returns a Matcher that will match
when the actual value is within `delta` of `expected`. Given only
`delta`, returns a function to be used in the context of `match-with`,
e.g.

  (is (match? (m/match-with [number? (m/within-delta 0.01M)]
                            <expected>)
              <actual>))
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close