()
| 21 | |
| 22 | #[test] |
| 23 | fn downcast_mut() { |
| 24 | let mut report = create_report(); |
| 25 | assert!(report.contains::<RootError>()); |
| 26 | |
| 27 | assert!(!report.contains::<AttachmentA>()); |
| 28 | report = report.attach_opaque(AttachmentA(10)); |
| 29 | assert!(report.contains::<AttachmentA>()); |
| 30 | |
| 31 | let attachment = report |
| 32 | .downcast_mut::<AttachmentA>() |
| 33 | .expect("Attachment not found"); |
| 34 | attachment.0 += 10; |
| 35 | |
| 36 | let attachment = report |
| 37 | .downcast_ref::<AttachmentA>() |
| 38 | .expect("Attachment not found"); |
| 39 | assert_eq!(attachment.0, 20); |
| 40 | } |
| 41 | |
| 42 | #[test] |
| 43 | fn downcast_mut_deep() { |
nothing calls this directly
no test coverage detected