()
| 65 | |
| 66 | #[test] |
| 67 | fn printable_attachment() { |
| 68 | let mut report = create_report() |
| 69 | .attach(PrintableA(10)) |
| 70 | .attach(PrintableB(20)); |
| 71 | |
| 72 | let flow = report.frames_mut(|frame| { |
| 73 | let source = frame |
| 74 | .sources_mut() |
| 75 | .first_mut() |
| 76 | .expect("No source frame found"); |
| 77 | let attachment = source |
| 78 | .downcast_mut::<PrintableA>() |
| 79 | .expect("Wrong source frame"); |
| 80 | attachment.0 += 10; |
| 81 | ControlFlow::Break(()) |
| 82 | }); |
| 83 | assert!(flow.is_break(), "No frame found"); |
| 84 | |
| 85 | let frame = report.frames().next().expect("No frame found"); |
| 86 | assert_eq!(frame.sources().len(), 1); |
| 87 | let source = frame.sources().first().expect("No source frame found"); |
| 88 | let attachment = source |
| 89 | .downcast_ref::<PrintableA>() |
| 90 | .expect("Wrong source frame"); |
| 91 | assert_eq!(attachment.0, 20); |
| 92 | } |
| 93 | |
| 94 | #[test] |
| 95 | fn context() { |
nothing calls this directly
no test coverage detected