MCPcopy Create free account
hub / github.com/hashintel/hash / captured

Function captured

libs/error-stack/tests/test_span_trace.rs:22–53  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

20
21#[test]
22fn captured() {
23 #[tracing::instrument]
24 fn func_b() -> Result<(), Report<RootError>> {
25 create_error()
26 }
27
28 #[tracing::instrument]
29 fn func_a() -> Result<(), Report<RootError>> {
30 func_b()
31 }
32
33 install_tracing_subscriber();
34
35 let report = capture_error(func_a);
36
37 #[cfg(nightly)]
38 let span_trace = report
39 .request_ref::<SpanTrace>()
40 .next()
41 .expect("No span trace captured");
42 #[cfg(not(nightly))]
43 let span_trace = report
44 .downcast_ref::<SpanTrace>()
45 .expect("No span trace captured");
46
47 let mut num_spans = 0;
48 span_trace.with_spans(|_, _| {
49 num_spans += 1;
50 true
51 });
52 assert_eq!(num_spans, 2);
53}
54
55#[test]
56fn provided() {

Callers

nothing calls this directly

Calls 4

capture_errorFunction · 0.85
expectMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected