macro_rules! assert_not_ends_with { ($whole:expr, $part:expr $(,)?) => { ... }; ($whole:expr, $part:expr, $($message:tt)+) => { ... }; }
Expand description
Assert an expression (such as a string) does not end with an expression (such as a string).
Pseudocode:
¬ a.ends_with(b)
-
If true, return
(). -
Otherwise, call
panic!with a message and the values of the expressions with their debug representations.
§Examples
use assertables::*;
// String ends with substring?
let whole: &str = "alfa";
let part: &str = "al";
assert_not_ends_with!(sequence, x);
// Vector ends with element?
let whole = vec![1, 2, 3];
let part = [1];
assert_not_ends_with!(sequence, x);
// This will panic
let whole = "alfa";
let part = "fa";
assert_not_ends_with!(sequence, x);
// assertion failed: `assert_not_ends_with!(sequence, x)`
// https://docs.rs/assertables/9.2.0/assertables/macro.assert_not_ends_with.html
// whole label: `whole`,
// whole debug: `\"alfa\"`,
// part label: `part`,
// part debug: `\"fa\"`