foundry_cheatcodes::test::assert

Macro impl_assertions

Source
macro_rules! impl_assertions {
    (|$($arg:ident),*| $body:expr, $format_error:literal, $(($no_error:ident, $with_error:ident)),* $(,)?) => { ... };
    (|$($arg:ident),*| $body:expr, $(($no_error:ident, $with_error:ident)),* $(,)?) => { ... };
    (|$($arg:ident),*| $body:expr, $error_formatter:expr, $(($no_error:ident, $with_error:ident)),* $(,)?) => { ... };
    (@args_tt |$args:tt| $body:expr, $error_formatter:expr, $format_error:literal, $(($no_error:ident, $with_error:ident)),* $(,)?) => { ... };
    (@impl $no_error:ident, $with_error:ident, ($($arg:ident),*), $body:expr, $error_formatter:expr, $format_error:literal) => { ... };
}
Expand description

Implements crate::Cheatcode for pairs of cheatcodes.

Accepts a list of pairs of cheatcodes, where the first cheatcode is the one that doesn’t contain a custom error message, and the second one contains it at error field.

Passed args are the common arguments for both cheatcode structs (excluding error field).

Macro also accepts an optional closure that formats the error returned by the assertion.