]> git.lizzy.rs Git - rust.git/blob - src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.no_cov_crate.txt
Rollup merge of #93613 - crlf0710:rename_to_async_iter, r=yaahc
[rust.git] / src / test / run-make-fulldeps / coverage-reports / expected_show_coverage.no_cov_crate.txt
1     1|       |// Enables `no_coverage` on the entire crate
2     2|       |#![feature(no_coverage)]
3     3|       |
4     4|       |#[no_coverage]
5     5|       |fn do_not_add_coverage_1() {
6     6|       |    println!("called but not covered");
7     7|       |}
8     8|       |
9     9|       |fn do_not_add_coverage_2() {
10    10|       |    #![no_coverage]
11    11|       |    println!("called but not covered");
12    12|       |}
13    13|       |
14    14|       |#[no_coverage]
15    15|       |fn do_not_add_coverage_not_called() {
16    16|       |    println!("not called and not covered");
17    17|       |}
18    18|       |
19    19|      1|fn add_coverage_1() {
20    20|      1|    println!("called and covered");
21    21|      1|}
22    22|       |
23    23|      1|fn add_coverage_2() {
24    24|      1|    println!("called and covered");
25    25|      1|}
26    26|       |
27    27|      0|fn add_coverage_not_called() {
28    28|      0|    println!("not called but covered");
29    29|      0|}
30    30|       |
31    31|       |// FIXME: These test-cases illustrate confusing results of nested functions.
32    32|       |// See https://github.com/rust-lang/rust/issues/93319
33    33|       |mod nested_fns {
34    34|       |    #[no_coverage]
35    35|       |    pub fn outer_not_covered(is_true: bool) {
36    36|      1|        fn inner(is_true: bool) {
37    37|      1|            if is_true {
38    38|      1|                println!("called and covered");
39    39|      1|            } else {
40    40|      0|                println!("absolutely not covered");
41    41|      0|            }
42    42|      1|        }
43    43|       |        println!("called but not covered");
44    44|       |        inner(is_true);
45    45|       |    }
46    46|       |
47    47|      1|    pub fn outer(is_true: bool) {
48    48|      1|        println!("called and covered");
49    49|      1|        inner_not_covered(is_true);
50    50|      1|
51    51|      1|        #[no_coverage]
52    52|      1|        fn inner_not_covered(is_true: bool) {
53    53|      1|            if is_true {
54    54|      1|                println!("called but not covered");
55    55|      1|            } else {
56    56|      1|                println!("absolutely not covered");
57    57|      1|            }
58    58|      1|        }
59    59|      1|    }
60    60|       |
61    61|      1|    pub fn outer_both_covered(is_true: bool) {
62    62|      1|        println!("called and covered");
63    63|      1|        inner(is_true);
64    64|      1|
65    65|      1|        fn inner(is_true: bool) {
66    66|      1|            if is_true {
67    67|      1|                println!("called and covered");
68    68|      1|            } else {
69    69|      0|                println!("absolutely not covered");
70    70|      0|            }
71    71|      1|        }
72    72|      1|    }
73    73|       |}
74    74|       |
75    75|      1|fn main() {
76    76|      1|    let is_true = std::env::args().len() == 1;
77    77|      1|
78    78|      1|    do_not_add_coverage_1();
79    79|      1|    do_not_add_coverage_2();
80    80|      1|    add_coverage_1();
81    81|      1|    add_coverage_2();
82    82|      1|
83    83|      1|    nested_fns::outer_not_covered(is_true);
84    84|      1|    nested_fns::outer(is_true);
85    85|      1|    nested_fns::outer_both_covered(is_true);
86    86|      1|}
87