Macro writeable::assert_try_writeable_eq

source ยท
macro_rules! assert_try_writeable_eq {
    ($actual_writeable:expr, $expected_str:expr $(,)?) => { ... };
    ($actual_writeable:expr, $expected_str:expr, $expected_result:expr $(,)?) => { ... };
    ($actual_writeable:expr, $expected_str:expr, $expected_result:expr, $($arg:tt)+) => { ... };
    (@internal, $actual_writeable:expr, $expected_str:expr, $expected_result:expr, $($arg:tt)+) => { ... };
}
Expand description

Testing macros for types implementing TryWriteable.

Arguments, in order:

  1. The TryWriteable under test
  2. The expected string value
  3. The expected result value, or Ok(()) if omitted
  4. *_parts_eq only: a list of parts ([(start, end, Part)])

Any remaining arguments get passed to format!

The macros tests the following:

  • Equality of string content
  • Equality of parts (*_parts_eq only)
  • Validity of size hint
  • Reflexivity of cmp_bytes and order against largest and smallest strings

For a usage example, see TryWriteable.