From 9259190c574378546bb82712367cb3f131e5a6db Mon Sep 17 00:00:00 2001 From: bendn Date: Thu, 12 Oct 2023 06:16:26 +0700 Subject: [PATCH] add stdout helper method --- src/libtest.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libtest.rs b/src/libtest.rs index fbf3135f..3d1f4a1b 100644 --- a/src/libtest.rs +++ b/src/libtest.rs @@ -98,6 +98,14 @@ impl TestEvent { | Self::Timeout { name }) = self; name } + + /// Get the stdout of this test, if available. + pub fn stdout(&self) -> Option<&str> { + match self { + Self::Ok { stdout, .. } | Self::Failed { stdout, .. } => stdout.as_deref(), + _ => None, + } + } } #[derive(Debug, PartialEq, Deserialize, Serialize)]