summaryrefslogtreecommitdiffstats
path: root/tests/run-coverage/loops_branches.coverage
blob: 148a22377f32aff3b6e8f774303faf6d71cc8c5e (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
   LL|       |#![allow(unused_assignments, unused_variables, while_true)]
   LL|       |
   LL|       |// This test confirms that (1) unexecuted infinite loops are handled correctly by the
   LL|       |// InstrumentCoverage MIR pass; and (2) Counter Expressions that subtract from zero can be dropped.
   LL|       |
   LL|       |struct DebugTest;
   LL|       |
   LL|       |impl std::fmt::Debug for DebugTest {
   LL|      1|    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
   LL|      1|        if true {
   LL|      1|            if false {
   LL|      0|                while true {
   LL|      0|                }
   LL|      1|            }
   LL|      1|            write!(f, "cool")?;
                                           ^0
   LL|      0|        } else {
   LL|      0|        }
   LL|       |
   LL|     11|        for i in 0..10 {
                          ^10
   LL|     10|            if true {
   LL|     10|                if false {
   LL|      0|                    while true {}
   LL|     10|                }
   LL|     10|                write!(f, "cool")?;
                                               ^0
   LL|      0|            } else {
   LL|      0|            }
   LL|       |        }
   LL|      1|        Ok(())
   LL|      1|    }
   LL|       |}
   LL|       |
   LL|       |struct DisplayTest;
   LL|       |
   LL|       |impl std::fmt::Display for DisplayTest {
   LL|      1|    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
   LL|      1|        if false {
   LL|      0|        } else {
   LL|      1|            if false {
   LL|      0|                while true {}
   LL|      1|            }
   LL|      1|            write!(f, "cool")?;
                                           ^0
   LL|       |        }
   LL|     11|        for i in 0..10 {
                          ^10
   LL|     10|            if false {
   LL|      0|            } else {
   LL|     10|                if false {
   LL|      0|                    while true {}
   LL|     10|                }
   LL|     10|                write!(f, "cool")?;
                                               ^0
   LL|       |            }
   LL|       |        }
   LL|      1|        Ok(())
   LL|      1|    }
   LL|       |}
   LL|       |
   LL|      1|fn main() {
   LL|      1|    let debug_test = DebugTest;
   LL|      1|    println!("{:?}", debug_test);
   LL|      1|    let display_test = DisplayTest;
   LL|      1|    println!("{}", display_test);
   LL|      1|}