()
| 390 | ); |
| 391 | } |
| 392 | |
| 393 | #[test] |
| 394 | fn for_each_struct_array() { |
| 395 | // Element is a struct value; field reads through the by-value binding. |
| 396 | // (1+2) + (3+4) + (5+6) = 21. |
| 397 | assert_exit( |
| 398 | r#" |
| 399 | struct Point { |
| 400 | x: i32 |
| 401 | y: i32 |
| 402 | } |
| 403 | |
| 404 | main: () -> i32 { |
| 405 | pts: Point[3] = [Point { .x = 1, .y = 2 }, Point { .x = 3, .y = 4 }, Point { .x = 5, .y = 6 }] |
| 406 | total: i32 = 0 |
| 407 | for p in pts { |
| 408 | total = total + p.x + p.y |
| 409 | } |
| 410 | return total |
| 411 | } |
| 412 | "#, |
| 413 | 21, |
| 414 | ); |
| 415 | } |
| 416 |
nothing calls this directly
no test coverage detected