Skip to content
This repository has been archived by the owner on Jan 18, 2025. It is now read-only.

Latest commit

 

History

History
74 lines (55 loc) · 2.35 KB

README.md

File metadata and controls

74 lines (55 loc) · 2.35 KB

coverage-helper

crates.io docs.rs license msrv github actions maintenance-status

Note: This crate is now deprecated in favor of the pattern that is recommended in the cargo-llvm-cov documentation.

If you want to ignore all #[test]-related code, you can use module-level #[coverage(off)] attribute:

#![cfg_attr(coverage_nightly, feature(coverage_attribute))]

#[cfg(test)]
#[cfg_attr(coverage_nightly, coverage(off))]
mod tests {
    // ...
}

cargo-llvm-cov excludes code contained in the directory named tests from the report by default, so you can also use it instead of #[coverage(off)] attribute.


Helper for taiki-e/cargo-llvm-cov#123.

Note: coverage-helper 0.2 supports #[coverage(off)]. See coverage-helper 0.1 for versions that support #[no_coverage].

Usage

Add this to your Cargo.toml:

[dev-dependencies]
coverage-helper = "0.2"

Examples

use coverage_helper::test;

#[test]
fn my_test() {
    // ...
}

Expanded to:

#[cfg_attr(all(coverage_nightly, test), coverage(off))]
#[::core::prelude::v1::test]
fn my_test() {
    // ...
}

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.