Module lib::assert_starts_with

source ·
Expand description

Assert for a whole that may start with a part.

These macros help with comparison of a whole (such as a string, vector, range) and a part (such as a string substring, an array element, a range value).

§Example

use assertables::*;

// String starts with substring?
let whole: &str = "alfa";
let part: &str = "al";
assert_starts_with!(sequence, x);

// Vector starts with element?
let whole = vec![1, 2, 3];
let part = [1];
assert_starts_with!(sequence, x);

Modules§

  • Assert an expression (such as a string) does not start with an expression (such as a string).
  • Assert an expression (such as a string) starts with an expression (such as a string).