macro_rules! assert_not_empty {
($expression:expr) => { ... };
($expression:expr, $($arg:tt)+) => { ... };
}Expand description
Asserts that expression is not empty using is_empty.
§Uses
Assertions are always checked in both debug and release builds, and cannot be disabled.
See debug_assert_not_empty! for assertions that are not enabled in release builds by default.
§Custom messages
This macro has a second form, where a custom panic message can be provided
with or without arguments for formatting. See std::fmt for syntax for this form.
§Examples
use testutils::assert_not_empty;
let vec: Vec<usize> = vec![1];
assert_not_empty!(vec);
// With custom messages
assert_not_empty!(vec, "Expecting {:?} to not be empty", vec);A empty value will cause a panic:
ⓘ
use testutils::assert_not_empty;
let vec: Vec<usize> = vec![];
assert_not_empty!(vec); // Will panic
//