about summary refs log tree commit diff
path: root/tests/coverage/coverage_attr_closure.coverage
blob: 31898786afc0f5f0989218889d0ef5f8b9ae7a5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
   LL|       |#![feature(stmt_expr_attributes)]
   LL|       |#![allow(dead_code)]
   LL|       |//@ edition: 2021
   LL|       |
   LL|       |static GLOBAL_CLOSURE_ON: fn(&str) = #[coverage(on)]
   LL|      0||input: &str| {
   LL|      0|    println!("{input}");
   LL|      0|};
   LL|       |static GLOBAL_CLOSURE_OFF: fn(&str) = #[coverage(off)]
   LL|       ||input: &str| {
   LL|       |    println!("{input}");
   LL|       |};
   LL|       |
   LL|       |#[coverage(on)]
   LL|      1|fn contains_closures_on() {
   LL|      1|    let _local_closure_on = #[coverage(on)]
   LL|      0|    |input: &str| {
   LL|      0|        println!("{input}");
   LL|      0|    };
   LL|      1|    let _local_closure_off = #[coverage(off)]
   LL|       |    |input: &str| {
   LL|       |        println!("{input}");
   LL|       |    };
   LL|      1|}
   LL|       |
   LL|       |#[coverage(off)]
   LL|       |fn contains_closures_off() {
   LL|       |    let _local_closure_on = #[coverage(on)]
   LL|      0|    |input: &str| {
   LL|      0|        println!("{input}");
   LL|      0|    };
   LL|       |    let _local_closure_off = #[coverage(off)]
   LL|       |    |input: &str| {
   LL|       |        println!("{input}");
   LL|       |    };
   LL|       |}
   LL|       |
   LL|       |#[coverage(off)]
   LL|       |fn main() {
   LL|       |    contains_closures_on();
   LL|       |    contains_closures_off();
   LL|       |}