Expand description
Assert for a sequence that may start with a part.
These macros help with comparison of a sequence (such as a string, vector, range) and a part (such as a string substring, an array element, a range value).
-
assert_starts_with(sequence, subsequence)≈ container.contains(containee) -
assert_not_starts_with!(sequence, subsequence)≈ !container.contains(containee)
§Example
use assertables::*;
// String starts with substring?
let sequence: &str = "alfa";
let subsequence: &str = "al";
assert_starts_with!(sequence, subsequence);
// Vector starts with element?
let sequence = vec![1, 2, 3];
let subsequence = [1];
assert_starts_with!(sequence, subsequence);Modules§
- assert_
not_ starts_ with - Assert an expression (such as a string) does not start with an expression (such as a string).
- assert_
starts_ with - Assert an expression (such as a string) starts with an expression (such as a string).