Function assert_that

Source
pub fn assert_that<'t, T>(actual: T) -> AssertThat<'t, T, Panic>
Expand description

The main entrypoint in an assertion context.

ยงExample Usage
use assertr::prelude::*;

// This will panic with a descriptive message and a pointer to the actual line of the assertion.
assert_that(3).is_equal_to(4);

// This instead captures the assertion failure for later inspection.
let failures = assert_that(3)
    .with_capture()
    .is_equal_to(4) // This will collect a failure instead of panicking.
    .capture_failures();

assert_that(failures)
    .has_length(1)
    .contains("");