Debian Codegraph @

third_party/rust/tracing/tests/no_subscriber.rs

raw
1 #![cfg(feature = "std")]
2
3 use tracing::subscriber::{self, NoSubscriber};
4
5 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
6 #[test]
7 fn no_subscriber_disables_global() {
8 // Reproduces https://github.com/tokio-rs/tracing/issues/1999
9 let (subscriber, handle) = tracing_mock::subscriber::mock().done().run_with_handle();
10 subscriber::set_global_default(subscriber).expect("setting global default must succeed");
11 subscriber::with_default(NoSubscriber::default(), || {
12 tracing::info!("this should not be recorded");
13 });
14 handle.assert_finished();
15 }