coverage: Allow #[coverage(..)]
on impl
and mod
These attributes apply to all enclosed functions/methods/closures, unless explicitly overridden by another coverage attribute.
This commit is contained in:
parent
3262611cc5
commit
7f37f8af5f
13 changed files with 253 additions and 170 deletions
38
tests/coverage/attr/module.coverage
Normal file
38
tests/coverage/attr/module.coverage
Normal file
|
@ -0,0 +1,38 @@
|
|||
LL| |#![feature(coverage_attribute)]
|
||||
LL| |//@ edition: 2021
|
||||
LL| |
|
||||
LL| |// Checks that `#[coverage(..)]` can be applied to modules, and is inherited
|
||||
LL| |// by any enclosed functions.
|
||||
LL| |
|
||||
LL| |#[coverage(off)]
|
||||
LL| |mod off {
|
||||
LL| | fn inherit() {}
|
||||
LL| |
|
||||
LL| | #[coverage(on)]
|
||||
LL| 0| fn on() {}
|
||||
LL| |
|
||||
LL| | #[coverage(off)]
|
||||
LL| | fn off() {}
|
||||
LL| |}
|
||||
LL| |
|
||||
LL| |#[coverage(on)]
|
||||
LL| |mod on {
|
||||
LL| 0| fn inherit() {}
|
||||
LL| |
|
||||
LL| | #[coverage(on)]
|
||||
LL| 0| fn on() {}
|
||||
LL| |
|
||||
LL| | #[coverage(off)]
|
||||
LL| | fn off() {}
|
||||
LL| |}
|
||||
LL| |
|
||||
LL| |#[coverage(off)]
|
||||
LL| |mod nested_a {
|
||||
LL| | mod nested_b {
|
||||
LL| | fn inner() {}
|
||||
LL| | }
|
||||
LL| |}
|
||||
LL| |
|
||||
LL| |#[coverage(off)]
|
||||
LL| |fn main() {}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue