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