()
| 8 | |
| 9 | #[test] |
| 10 | fn opaque_attachment() { |
| 11 | let mut report = create_report() |
| 12 | .attach_opaque(AttachmentA(10)) |
| 13 | .attach_opaque(AttachmentB(20)); |
| 14 | |
| 15 | let flow = report.frames_mut(|frame| { |
| 16 | let source = frame |
| 17 | .sources_mut() |
| 18 | .first_mut() |
| 19 | .expect("No source frame found"); |
| 20 | let attachment = source |
| 21 | .downcast_mut::<AttachmentA>() |
| 22 | .expect("Wrong source frame"); |
| 23 | attachment.0 += 10; |
| 24 | ControlFlow::Break(()) |
| 25 | }); |
| 26 | assert!(flow.is_break(), "No frame found"); |
| 27 | |
| 28 | let frame = report.frames().next().expect("No frame found"); |
| 29 | assert_eq!(frame.sources().len(), 1); |
| 30 | let source = frame.sources().first().expect("No source frame found"); |
| 31 | let attachment = source |
| 32 | .downcast_ref::<AttachmentA>() |
| 33 | .expect("Wrong source frame"); |
| 34 | assert_eq!(attachment.0, 20); |
| 35 | } |
| 36 | |
| 37 | #[test] |
| 38 | fn sources() { |
nothing calls this directly
no test coverage detected