Expand description
All built-in matchers of this crate are in submodules of this module.
Macros§
- all
- Matches a value which all of the given matchers match.
- any
- Matches a value which at least one of the given matchers match.
- contains_
each - Matches a container containing elements matched by the given matchers.
- elements_
are - Matches a container’s elements to each matcher in order.
- field
- Matches a structure or enum with a given field which is matched by a given matcher.
- is_
contained_ in - Matches a container all of whose elements are matched by the given matchers.
- matches_
pattern - Matches a value according to a pattern of matchers.
- pat
- An alias for
matches_pattern. - pointwise
- Generates a matcher which matches a container each of whose elements match the given matcher name applied respectively to each element of the given container.
- property
- Matches an object which, upon calling the given method on it with the given arguments, produces a value matched by the given inner matcher.
- result_
of - Matches a value where the result of
callableapplied to the value matches the inner matcher. - result_
of_ ref - Matches a value where the reference to the result of
callableapplied to the value matches the inner matcher. - unordered_
elements_ are - Matches a container whose elements in any order have a 1:1 correspondence with the provided element matchers.
Structs§
- Contains
Matcher - A matcher which matches a container containing one or more elements a given
inner
Matchermatches. - EqMatcher
- A matcher which matches a value equal to
expected. - Near
Matcher - A matcher which matches floating-point numbers approximately equal to its expected value.
- Predicate
Matcher - A matcher which applies
predicateon the value. - StrMatcher
- A matcher which matches equality or containment of a string-like value in a configurable way.
Traits§
- StrMatcher
Configurator - Extension trait to configure
StrMatcher.
Functions§
- anything
- Matches anything. This matcher always succeeds.
- approx_
eq - Matches a value approximately equal to
expected. - char_
count - Matches a string whose number of Unicode scalars matches
expected. - container_
eq - Matches a container equal (in the sense of
==) toexpected. - contains
- Matches an
IntoIteratortype whose elements contain a value matched byinner. - contains_
regex - Matches a string containing a substring which matches the given regular expression.
- contains_
substring - Matches a string containing a given substring.
- derefs_
to - Dereferences the
actualvalue and verifies that the returned reference matches theinnermatcher. - displays_
as - Matches the string representation of types that implement
Display. - each
- Matches a container all of whose elements are matched by the matcher
inner. - empty
Deprecated - This is deprecated. Use
is_empty()instead. - ends_
with - Matches a string which ends with the given suffix.
- eq
- Matches a value equal (in the sense of
==) toexpected. - err
- Matches a
ResultcontainingErrwith a value matched byinner. - ge
- Matches a value greater than or equal to (in the sense of
>=)expected. - gt
- Matches a value greater (in the sense of
>) thanexpected. - has_
entry - Matches a
&HashMapcontaining the givenkeywhose value is matched by the matcherinner. - is_
empty - Matches an empty container.
- is_
false - Matches boolean value
false. - is_
finite - Matches a floating point value which is Finite.
- is_
infinite - Matches a floating point value which is Infinite.
- is_nan
- Matches a floating point value which is NaN.
- is_true
- Matches boolean value
true. - is_
utf8_ string - Matches a byte sequence which is a UTF-8 encoded string matched by
inner. - le
- Matches a value less than or equal to (in the sense of
<=)expected. - len
- Matches a container whose number of elements matches
expected. - lt
- Matches a value less (in the sense of
<) thanexpected. - matches_
regex - Matches a string the entirety of which which matches the given regular expression.
- near
- Matches a value equal within
max_abs_errorofexpected. - none
- Matches an
OptioncontainingNone. - not
- Matches the actual value exactly when the inner matcher does not match.
- ok
- Matches a
ResultcontainingOkwith a value matched byinner. - points_
to - Matches a reference pointing to a value matched by the
Matcherexpected. - predicate
- Creates a matcher based on the predicate provided.
- some
- Matches an
Optioncontaining a value matched byinner. - starts_
with - Matches a string which starts with the given prefix.
- subset_
of - Matches a container all of whose items are in the given container
superset. - superset_
of - Matches a container containing all of the items in the given container
subset.