1 1| |// Enables `no_coverage` on the entire crate
2 2| |#![feature(no_coverage)]
5 5| |fn do_not_add_coverage_1() {
6 6| | println!("called but not covered");
9 9| |fn do_not_add_coverage_2() {
11 11| | println!("called but not covered");
15 15| |fn do_not_add_coverage_not_called() {
16 16| | println!("not called and not covered");
19 19| 1|fn add_coverage_1() {
20 20| 1| println!("called and covered");
23 23| 1|fn add_coverage_2() {
24 24| 1| println!("called and covered");
27 27| 0|fn add_coverage_not_called() {
28 28| 0| println!("not called but covered");
31 31| |// FIXME: These test-cases illustrate confusing results of nested functions.
32 32| |// See https://github.com/rust-lang/rust/issues/93319
35 35| | pub fn outer_not_covered(is_true: bool) {
36 36| 1| fn inner(is_true: bool) {
38 38| 1| println!("called and covered");
40 40| 0| println!("absolutely not covered");
43 43| | println!("called but not covered");
47 47| 1| pub fn outer(is_true: bool) {
48 48| 1| println!("called and covered");
49 49| 1| inner_not_covered(is_true);
52 52| 1| fn inner_not_covered(is_true: bool) {
54 54| 1| println!("called but not covered");
56 56| 1| println!("absolutely not covered");
61 61| 1| pub fn outer_both_covered(is_true: bool) {
62 62| 1| println!("called and covered");
63 63| 1| inner(is_true);
65 65| 1| fn inner(is_true: bool) {
67 67| 1| println!("called and covered");
69 69| 0| println!("absolutely not covered");
76 76| 1| let is_true = std::env::args().len() == 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();
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);