Expand description
Macros for testing conditions without panicking. The expect_* family of macros cause an early
return of an anyhow::Error if the expected condition is not met.
Macrosยง
- expect
- Expects that the given condition evaluates to
true; otherwise returns early. - expect_
contains - Expects that the given container (e.g.,
Vec) contains the element or given string contains the substring; otherwise returns early. - expect_
empty - Expects that the given container (e.g.,
Vec) is empty; otherwise returns early. - expect_
eq - Expects that a == b; otherwise returns early.
- expect_
err - Expects that the given
ResultisErrand returns the unwrapped error; otherwise returns early. - expect_
ne - Expects that a != b; otherwise returns early.
- expect_
none - Expects that the given
OptionisNone; otherwise returns early. - expect_
not_ empty - Expects that the given container (e.g.,
Vec) contains at least one element or given string has non-zero length; otherwise returns early. - expect_
ok - Expects that the given
ResultisOkand returns its unwrapped contents; otherwise returns early. - expect_
some - Expects that the given
OptionisSomeand returns its unwrapped contents; otherwise returns early. - expect_
some_ eq - Expects that
aisSomeand its contents are equal tob.