From 934dc420a89693fbe6d712625239a3c0cf4e8835 Mon Sep 17 00:00:00 2001 From: Floris Bruynooghe Date: Thu, 21 Jan 2021 20:40:16 +0100 Subject: [PATCH] Add Debug back to TestContext I accidentally removed this in an earlier PR. --- src/test_utils.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/test_utils.rs b/src/test_utils.rs index 1a769ae1c..b738145b4 100644 --- a/src/test_utils.rs +++ b/src/test_utils.rs @@ -3,6 +3,7 @@ //! This module is only compiled for test runs. use std::collections::BTreeMap; +use std::fmt; use std::ops::Deref; use std::str::FromStr; use std::time::{Duration, Instant}; @@ -45,7 +46,6 @@ static CONTEXT_NAMES: Lazy>> = /// /// The temporary directory can be used to store the SQLite database, /// see e.g. [test_context] which does this. -// #[derive(Debug)] pub(crate) struct TestContext { pub ctx: Context, pub dir: TempDir, @@ -55,6 +55,17 @@ pub(crate) struct TestContext { event_sinks: Arc>>>, } +impl fmt::Debug for TestContext { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("TestContext") + .field("ctx", &self.ctx) + .field("dir", &self.dir) + .field("recv_idx", &self.recv_idx) + .field("event_sinks", &String::from("Vec")) + .finish() + } +} + impl TestContext { /// Creates a new [TestContext]. ///