Crate xpct

source ·
Expand description

xpct is an assertions library for Rust.

It’s designed to be ergonomic, batteries-included, and test framework agnostic.

If you’re new here, you may want to check out the Tutorial and the rest of the User Docs.

Modules

Core types for the library.
docsdocsrs
User Docs
The formatters provided by this crate.
The matchers provided by this crate.

Macros

Make an assertion.
Apply matchers to multiple struct fields.
Return the current FileLocation.
Construct a new Pattern value from a match pattern.

Structs

An error that occurs in a matcher.

Functions

Succeeds when all of the passed matchers succeed.
Succeeds when any of the passed matchers succeed.
Succeeds when the actual f32 value approximately equals the expected f32 value.
Succeeds when the actual f64 value approximately equals the expected f64 value.
Succeeds when the actual time approximately equals the expected time.
Succeeds when the actual value equals the default value for the type.
Succeeds when the actual value is an existing directory.
Succeeds when the actual value is empty.
Succeeds when the actual value is Err.
Succeeds when the actual value is an existing file.
Succeeds when the actual value is false.
Succeeds when the actual value is greater than or equal to the expected value.
Succeeds when the actual value is greater than the expected value.
Succeeds when the actual value is contained in the expected collection.
Succeeds when the actual value is less than or equal to the expected value.
Succeeds when the actual value is less than the expected value.
Succeeds when the actual value is None.
Succeeds when the actual value is Ok.
Succeeds when the actual value is an existing regular file.
Succeeds when the actual value is Some.
Succeeds when the actual value is sorted in ascending order.
Succeeds when the actual value is sorted according to the given predicate.
Succeeds when the actual value is sorted in descending order.
Succeeds when the actual value is an existing symbolic link.
Succeeds when the actual value is true.
Succeeds when the actual integer value is 0.
Succeeds when the actual value contains exactly the given elements, in any order.
Succeeds when the actual value contains the given element.
Succeeds when the actual value contains all the given elements.
Succeeds when the actual value contains the expected substring.
Succeeds when each of the passed matchers succeeds.
eq_casefoldcasefold
Succeeds when the actual string equals the expected string regardless of case.
Succeeds when the actual value equals the expected value.
Succeeds when the matcher succeeds for every element of the actual value.
Succeeds when the actual value has the given length.
Succeeds when the actual value has the expected prefix.
Succeeds when the actual value has the expected suffix.
Infallibly convert the input value via From/Into.
Infallibly map each value of an iterator by applying a function to it.
Fallibly map each value of an iterator by applying a function to it.
Infallibly map the input value by applying a function to it.
Succeeds when any of the fields of a struct succeed.
Succeeds when all the fields of a struct succeed.
Succeeds when the actual string and the expected string are equivalent JSON.
Succeeds when the given pattern matches.
Succeeds when the actual value matches the given regular expression.
Negates the matcher passed to it.
Fallibly convert the input value via TryFrom/TryInto.
Fallibly map the input value by applying a function to it.
Attaches a context string to a matcher that will appear in the failure output.
Attaches a lazily evaluated context string to a matcher that will appear in the failure output.

Type Definitions

A result type for Error.