summaryrefslogtreecommitdiffstats
path: root/vendor/tracing-subscriber/tests/utils.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /vendor/tracing-subscriber/tests/utils.rs
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/tracing-subscriber/tests/utils.rs')
-rw-r--r--vendor/tracing-subscriber/tests/utils.rs39
1 files changed, 39 insertions, 0 deletions
diff --git a/vendor/tracing-subscriber/tests/utils.rs b/vendor/tracing-subscriber/tests/utils.rs
new file mode 100644
index 000000000..e95868d5e
--- /dev/null
+++ b/vendor/tracing-subscriber/tests/utils.rs
@@ -0,0 +1,39 @@
+#![cfg(feature = "std")]
+
+use tracing_mock::*;
+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();
+}