Macro uncover::define_uncover_macros[][src]

macro_rules! define_uncover_macros {
    (enable_if($cond:expr)) => { ... };
}

Define covered_by! and covers! macros.

Use covered_by!("unique_name") in the code and covers!("unique_name") in the corresponding test to verify that the test indeed covers the code. Under the hood, covers! creates a guard object that checks coverage at scope exit.

If called as define_uncover_macros(enable_if(condition));, macros will be no-op unless condition is true. A typical condition is

define_uncover_macros!(
    enable_if(cfg!(debug_assertions))
);

You can use condition to enable uncover based on compile-time env var:

define_uncover_macros!(
    enable_if(option_env!("CI") == Some("1"))
);