macro_rules! rule_tests {
($rule:expr,
err: {
$(
$(#[$err_meta:meta])*
$code:literal
),* $(,)?
},
$(#[_:meta])*
ok: {
$(
$(#[$ok_meta:meta])*
$ok_code:literal
),* $(,)?
} $(,)?) => { ... };
(
$ok_name:ident,
$err_name:ident,
$rule:expr,
err: {
$(
$(#[$err_meta:meta])*
$code:literal
),* $(,)?
},
ok: {
$(
$(#[$ok_meta:meta])*
$ok_code:literal
),* $(,)?
} $(,)?) => { ... };
}
A macro for generating linter rule tests.
The tests are also used to generate "more examples" sections
in user facing docs. You can use a /// ignore
doc
on a code expr to make docgen ignore it for user facing docs.
test code is run as modules, not scripts.