()
| 54 | |
| 55 | #[test] |
| 56 | fn provided() { |
| 57 | #[tracing::instrument] |
| 58 | fn func_b() -> ErrorA { |
| 59 | ErrorA::new(0) |
| 60 | } |
| 61 | |
| 62 | #[tracing::instrument] |
| 63 | fn func_a() -> Result<(), Report<ErrorA>> { |
| 64 | Err(Report::new(func_b())) |
| 65 | } |
| 66 | |
| 67 | install_tracing_subscriber(); |
| 68 | |
| 69 | let report = capture_error(func_a); |
| 70 | #[cfg(nightly)] |
| 71 | let span_trace = report |
| 72 | .request_ref::<SpanTrace>() |
| 73 | .next() |
| 74 | .expect("No span trace captured"); |
| 75 | #[cfg(not(nightly))] |
| 76 | let span_trace = report |
| 77 | .downcast_ref::<SpanTrace>() |
| 78 | .expect("No span trace captured"); |
| 79 | |
| 80 | let mut num_spans = 0; |
| 81 | span_trace.with_spans(|_, _| { |
| 82 | num_spans += 1; |
| 83 | true |
| 84 | }); |
| 85 | |
| 86 | #[cfg(not(nightly))] |
| 87 | assert_eq!(num_spans, 1); |
| 88 | |
| 89 | #[cfg(nightly)] |
| 90 | assert_eq!(num_spans, 2); |
| 91 | } |
nothing calls this directly
no test coverage detected