pub fn assert_that<'a, S>(subject: S) -> Spec<'a, S, PanicOnFail>Expand description
Starts an assertion for the given subject or expression in the
PanicOnFail mode.
It wraps the subject into a Spec. On the Spec any
assertion method that is implemented for the subject’s type can be called.
Assertions started with assert_that() will panic on the first failing
assertion.
In comparison to using the macro assert_that!
calling this function does not set a name for the expression and does not
set the code location of the assertion. In failure messages, the generic word
“subject” is used. To set a specific text for the expression, the method
named must be called explicitly.
Note: It is not necessary to set the code location explicitly as this
function is annotated with #[track_caller].
§Examples
use asserting::prelude::*;
assert_that(7 * 6).is_equal_to(42);or with setting a name for the expression:
use asserting::prelude::*;
assert_that(7 * 6)
.named("7 * 6")
.is_equal_to(42);