From ab9f824dec3f9c05130b4b3beadb765a891ed182 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Sat, 10 Sep 2022 22:29:00 +0200 Subject: [PATCH] component: impl Debug for Expect MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maxime “pep” Buquet --- src/component.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/component.rs b/src/component.rs index 7822304..6a7f672 100644 --- a/src/component.rs +++ b/src/component.rs @@ -6,6 +6,7 @@ use crate::error::Error; +use std::fmt; use std::marker::Send; use std::ops::{Deref, DerefMut}; use std::pin::Pin; @@ -80,6 +81,17 @@ enum Expect { Callback(Box), } +impl fmt::Debug for Expect { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "Expect::")?; + match self { + Expect::Element(el) => write!(f, "Element({:?})", String::from(el)), + Expect::Callback(_) => write!(f, "Callback()"), + } + } +} + +#[derive(Debug)] pub struct TestComponent { in_buffer: Vec, out_buffer: Vec,