()
| 146 | named := Point { .y = 2, .x = 1 } |
| 147 | contextual: Point = { .x = 3, .y = 4 } |
| 148 | return named.x + named.y + contextual.x + contextual.y |
| 149 | } |
| 150 | "#, |
| 151 | 10, |
| 152 | ); |
| 153 | } |
| 154 | |
| 155 | #[test] |
| 156 | fn contextual_literal_zero_fills() { |
| 157 | // Omitted fields in an anonymous literal default to zero at runtime. |
| 158 | assert_exit( |
| 159 | r#" |
| 160 | struct Point { |
| 161 | x: i32 |
| 162 | y: i32 |
| 163 | } |
| 164 | |
| 165 | main: () -> i32 { |
| 166 | point: Point = { .x = 7, .. } |
| 167 | return point.x + point.y |
nothing calls this directly
no test coverage detected