Expand description
Assert for a whole that may end with a part.
These macros help with comparison of a whole (such as a string, array, range) and a part (such as a string substring, an array element, a range value).
-
assert_ends_with(sequence, x)≈ container.contains(containee) -
assert_not_ends_with!(sequence, x)≈ !container.contains(containee)
§Example
use assertables::*;
// String ends with substring?
let whole: &str = "alfa";
let part: &str = "fa";
assert_ends_with!(sequence, x);
// Vector ends with element?
let whole = vec![1, 2, 3];
let part = [3];
assert_ends_with!(sequence, x);Modules§
- Assert an expression (such as a string) ends with an expression (such as a string).
- Assert an expression (such as a string) does not end with an expression (such as a string).