macro_rules! assert_not_empty { ($a:expr $(,)?) => { ... }; ($a:expr, $($message:tt)+) => { ... }; }
Expand description
Assert an expression (such as a string or array) is not empty.
Pseudocode:
¬ a.is_empty()
-
If true, return
(). -
Otherwise, call
panic!with a message and the values of the expressions with their debug representations.
§Examples
use assertables::*;
let a = "alfa";
assert_not_empty!(a);
let a = "";
assert_not_empty!(a);
// assertion failed: `assert_not_empty!(a)`
// https://docs.rs/assertables/8.14.0/assertables/macro.assert_not_empty.html
// label: `a`,
// debug: `\"\"`