()
| 93 | |
| 94 | #[test] |
| 95 | fn context() { |
| 96 | let mut report = create_report().change_context(ContextA(10)); |
| 97 | |
| 98 | let flow = report.frames_mut(|frame| { |
| 99 | assert_eq!(frame.sources().len(), 1); |
| 100 | assert!(frame.is::<Location>(), "not a location frame"); |
| 101 | |
| 102 | let source = frame |
| 103 | .sources_mut() |
| 104 | .first_mut() |
| 105 | .expect("no source frame found"); |
| 106 | |
| 107 | let context = source |
| 108 | .downcast_mut::<ContextA>() |
| 109 | .expect("not a context frame"); |
| 110 | context.0 += 10; |
| 111 | ControlFlow::Break(()) |
| 112 | }); |
| 113 | assert!(flow.is_break(), "No location frame found"); |
| 114 | |
| 115 | let frame = report.frames().next().expect("No location frame found"); |
| 116 | assert_eq!(frame.sources().len(), 1); |
| 117 | let source = frame.sources().first().expect("no source frame found"); |
| 118 | let context = source |
| 119 | .downcast_ref::<ContextA>() |
| 120 | .expect("not a context frame"); |
| 121 | assert_eq!(context.0, 20); |
| 122 | } |
| 123 | |
| 124 | #[test] |
| 125 | fn type_id() { |
no test coverage detected