]> git.lizzy.rs Git - rust.git/blob - src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.issue-84561.txt
Auto merge of #84997 - pietroalbini:ci-verify-channel, r=Mark-Simulacrum
[rust.git] / src / test / run-make-fulldeps / coverage-reports / expected_show_coverage.issue-84561.txt
1     1|       |// This demonstrated Issue #84561: function-like macros produce unintuitive coverage results.
2     2|       |
3     3|       |// expect-exit-status-101
4     4|     21|#[derive(PartialEq, Eq)]
5   ------------------
6   | <issue_84561::Foo as core::cmp::PartialEq>::eq:
7   |    4|     21|#[derive(PartialEq, Eq)]
8   ------------------
9   | Unexecuted instantiation: <issue_84561::Foo as core::cmp::PartialEq>::ne
10   ------------------
11     5|       |struct Foo(u32);
12     6|      1|fn test3() {
13     7|      1|    let is_true = std::env::args().len() == 1;
14     8|      1|    let bar = Foo(1);
15     9|      1|    assert_eq!(bar, Foo(1));
16    10|      1|    let baz = Foo(0);
17    11|      1|    assert_ne!(baz, Foo(1));
18    12|      1|    println!("{:?}", Foo(1));
19    13|      1|    println!("{:?}", bar);
20    14|      1|    println!("{:?}", baz);
21    15|      1|
22    16|      1|    assert_eq!(Foo(1), Foo(1));
23    17|      1|    assert_ne!(Foo(0), Foo(1));
24    18|      1|    assert_eq!(Foo(2), Foo(2));
25    19|      1|    let bar = Foo(0);
26    20|      1|    assert_ne!(bar, Foo(3));
27    21|      1|    assert_ne!(Foo(0), Foo(4));
28    22|      1|    assert_eq!(Foo(3), Foo(3), "with a message");
29                                              ^0
30    23|      1|    println!("{:?}", bar);
31    24|      1|    println!("{:?}", Foo(1));
32    25|      1|
33    26|      1|    assert_ne!(Foo(0), Foo(5), "{}", if is_true { "true message" } else { "false message" });
34                                              ^0                 ^0                      ^0
35    27|      1|    assert_ne!(
36    28|       |        Foo(0)
37    29|       |        ,
38    30|       |        Foo(5)
39    31|       |        ,
40    32|      0|        "{}"
41    33|      0|        ,
42    34|      0|        if
43    35|      0|        is_true
44    36|       |        {
45    37|      0|            "true message"
46    38|       |        } else {
47    39|      0|            "false message"
48    40|       |        }
49    41|       |    );
50    42|       |
51    43|      1|    let is_true = std::env::args().len() == 1;
52    44|      1|
53    45|      1|    assert_eq!(
54    46|      1|        Foo(1),
55    47|      1|        Foo(1)
56    48|      1|    );
57    49|      1|    assert_ne!(
58    50|      1|        Foo(0),
59    51|      1|        Foo(1)
60    52|      1|    );
61    53|      1|    assert_eq!(
62    54|      1|        Foo(2),
63    55|      1|        Foo(2)
64    56|      1|    );
65    57|      1|    let bar = Foo(1);
66    58|      1|    assert_ne!(
67    59|      1|        bar,
68    60|      1|        Foo(3)
69    61|      1|    );
70    62|      1|    if is_true {
71    63|      1|        assert_ne!(
72    64|      1|            Foo(0),
73    65|      1|            Foo(4)
74    66|      1|        );
75    67|       |    } else {
76    68|      0|        assert_eq!(
77    69|      0|            Foo(3),
78    70|      0|            Foo(3)
79    71|      0|        );
80    72|       |    }
81    73|      1|    if is_true {
82    74|      1|        assert_ne!(
83    75|       |            Foo(0),
84    76|       |            Foo(4),
85    77|      0|            "with a message"
86    78|       |        );
87    79|       |    } else {
88    80|      0|        assert_eq!(
89    81|       |            Foo(3),
90    82|       |            Foo(3),
91    83|      0|            "with a message"
92    84|       |        );
93    85|       |    }
94    86|      1|    assert_ne!(
95    87|      1|        if is_true {
96    88|      1|            Foo(0)
97    89|       |        } else {
98    90|      0|            Foo(1)
99    91|       |        },
100    92|       |        Foo(5)
101    93|       |    );
102    94|      1|    assert_ne!(
103    95|      1|        Foo(5),
104    96|      1|        if is_true {
105    97|      1|            Foo(0)
106    98|       |        } else {
107    99|      0|            Foo(1)
108   100|       |        }
109   101|       |    );
110   102|      1|    assert_ne!(
111   103|      1|        if is_true {
112   104|      1|            assert_eq!(
113   105|      1|                Foo(3),
114   106|      1|                Foo(3)
115   107|      1|            );
116   108|      1|            Foo(0)
117   109|       |        } else {
118   110|      0|            assert_ne!(
119   111|      0|                if is_true {
120   112|      0|                    Foo(0)
121   113|       |                } else {
122   114|      0|                    Foo(1)
123   115|       |                },
124   116|       |                Foo(5)
125   117|       |            );
126   118|      0|            Foo(1)
127   119|       |        },
128   120|       |        Foo(5),
129   121|      0|        "with a message"
130   122|       |    );
131   123|      1|    assert_eq!(
132   124|       |        Foo(1),
133   125|       |        Foo(3),
134   126|      1|        "this assert should fail"
135   127|       |    );
136   128|      0|    assert_eq!(
137   129|       |        Foo(3),
138   130|       |        Foo(3),
139   131|      0|        "this assert should not be reached"
140   132|       |    );
141   133|      0|}
142   134|       |
143   135|       |impl std::fmt::Debug for Foo {
144   136|       |    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
145   137|      7|        write!(f, "try and succeed")?;
146                                                   ^0
147   138|      7|        Ok(())
148   139|      7|    }
149   140|       |}
150   141|       |
151   142|       |static mut DEBUG_LEVEL_ENABLED: bool = false;
152   143|       |
153   144|       |macro_rules! debug {
154   145|       |    ($($arg:tt)+) => (
155   146|       |        if unsafe { DEBUG_LEVEL_ENABLED } {
156   147|       |            println!($($arg)+);
157   148|       |        }
158   149|       |    );
159   150|       |}
160   151|       |
161   152|      1|fn test1() {
162   153|      1|    debug!("debug is enabled");
163                          ^0
164   154|      1|    debug!("debug is enabled");
165                          ^0
166   155|      1|    let _ = 0;
167   156|      1|    debug!("debug is enabled");
168                          ^0
169   157|      1|    unsafe {
170   158|      1|        DEBUG_LEVEL_ENABLED = true;
171   159|      1|    }
172   160|      1|    debug!("debug is enabled");
173   161|      1|}
174   162|       |
175   163|       |macro_rules! call_debug {
176   164|       |    ($($arg:tt)+) => (
177   165|      1|        fn call_print(s: &str) {
178   166|      1|            print!("{}", s);
179   167|      1|        }
180   168|       |
181   169|       |        call_print("called from call_debug: ");
182   170|       |        debug!($($arg)+);
183   171|       |    );
184   172|       |}
185   173|       |
186   174|      1|fn test2() {
187   175|      1|    call_debug!("debug is enabled");
188   176|      1|}
189   177|       |
190   178|      1|fn main() {
191   179|      1|    test1();
192   180|      1|    test2();
193   181|      1|    test3();
194   182|      1|}
195