aboutsummaryrefslogtreecommitdiff
path: root/src/testkit
diff options
context:
space:
mode:
Diffstat (limited to 'src/testkit')
-rw-r--r--src/testkit/display.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/testkit/display.rs b/src/testkit/display.rs
index a745b5c..3cffd49 100644
--- a/src/testkit/display.rs
+++ b/src/testkit/display.rs
@@ -20,6 +20,20 @@ pub struct DisplaySinkValidator {
spans: alloc::vec::Vec<&'static str>,
}
+impl DisplaySinkValidator {
+ pub fn new() -> Self {
+ Self { spans: alloc::vec::Vec::new() }
+ }
+}
+
+impl core::ops::Drop for DisplaySinkValidator {
+ fn drop(&mut self) {
+ if self.spans.len() != 0 {
+ panic!("DisplaySinkValidator dropped with open spans");
+ }
+ }
+}
+
impl fmt::Write for DisplaySinkValidator {
fn write_str(&mut self, _s: &str) -> Result<(), fmt::Error> {
Ok(())