()
| 36 | |
| 37 | #[test] |
| 38 | fn sources() { |
| 39 | let mut report_a = create_report().attach_opaque(AttachmentA(10)).expand(); |
| 40 | let report_b = create_report().attach_opaque(AttachmentA(20)); |
| 41 | report_a.push(report_b); |
| 42 | let mut report = report_a.attach_opaque(AttachmentB(30)); |
| 43 | |
| 44 | let flow = report.frames_mut(|frame| { |
| 45 | assert_eq!(frame.sources().len(), 2); |
| 46 | |
| 47 | for source in frame.sources_mut() { |
| 48 | let attachment = source |
| 49 | .downcast_mut::<AttachmentA>() |
| 50 | .expect("Wrong source frame"); |
| 51 | attachment.0 += 5; |
| 52 | } |
| 53 | ControlFlow::Break(()) |
| 54 | }); |
| 55 | assert!(flow.is_break(), "No frames"); |
| 56 | |
| 57 | let frame = report.frames().next().expect("No frames"); |
| 58 | for (source, expect) in zip(frame.sources(), [15, 25]) { |
| 59 | let attachment = source |
| 60 | .downcast_ref::<AttachmentA>() |
| 61 | .expect("Wrong source frame"); |
| 62 | assert_eq!(attachment.0, expect); |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | #[test] |
| 67 | fn printable_attachment() { |
nothing calls this directly
no test coverage detected