Macro assertables::assert_ends_with

source ·
macro_rules! assert_ends_with {
    ($a:expr, $b:expr $(,)?) => { ... };
    ($a:expr, $b:expr, $($message:tt)+) => { ... };
}
Expand description

Assert an expression (such as a string) ends with an expression (such as a string).

  • If true, return ().

  • Otherwise, call panic! with a message and the values of the expressions with their debug representations.

§Examples

let a = "alfa";
let b = "fa";
assert_ends_with!(a, b);

let a = "alfa";
let b = "al";
assert_ends_with!(a, b);
// assertion failed: `assert_ends_with!(a, b)`
//  a label: `a`,
//  a debug: `\"alfa\"`,
//  b label: `b`,
//  b debug: `\"al\"`

§Module macros