diff options
Diffstat (limited to 'vendor/tracing-subscriber-0.3.3/tests/utils.rs')
-rw-r--r-- | vendor/tracing-subscriber-0.3.3/tests/utils.rs | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/vendor/tracing-subscriber-0.3.3/tests/utils.rs b/vendor/tracing-subscriber-0.3.3/tests/utils.rs new file mode 100644 index 000000000..ff025a2a2 --- /dev/null +++ b/vendor/tracing-subscriber-0.3.3/tests/utils.rs @@ -0,0 +1,39 @@ +#![cfg(feature = "std")] +mod support; +use self::support::*; +use tracing_subscriber::prelude::*; + +#[test] +fn init_ext_works() { + let (subscriber, finished) = subscriber::mock() + .event( + event::mock() + .at_level(tracing::Level::INFO) + .with_target("init_works"), + ) + .done() + .run_with_handle(); + + let _guard = subscriber.set_default(); + tracing::info!(target: "init_works", "it worked!"); + finished.assert_finished(); +} + +#[test] +#[cfg(feature = "fmt")] +fn builders_are_init_ext() { + tracing_subscriber::fmt().set_default(); + let _ = tracing_subscriber::fmt() + .with_target(false) + .compact() + .try_init(); +} + +#[test] +#[cfg(all(feature = "fmt", feature = "env-filter"))] +fn layered_is_init_ext() { + tracing_subscriber::registry() + .with(tracing_subscriber::fmt::layer()) + .with(tracing_subscriber::EnvFilter::new("foo=info")) + .set_default(); +} |