pub struct ExpectedTestCase { /* private fields */ }
Expand description
A version of a test case result that contains all output in memory. This should only be used for making assertions in a test.
Implementations§
Source§impl ExpectedTestCase
impl ExpectedTestCase
Sourcepub fn new<S: AsRef<str>>(name: S, outcome: Outcome) -> Self
pub fn new<S: AsRef<str>>(name: S, outcome: Outcome) -> Self
Create a new ExpectedTestCase
with the given name
and outcome
.
Sourcepub fn with_artifact<S, T, U>(
self,
metadata: U,
name: Option<S>,
contents: T,
) -> Self
pub fn with_artifact<S, T, U>( self, metadata: U, name: Option<S>, contents: T, ) -> Self
Add an artifact matching the exact contents. Artifacts are checked by finding an entry matching the given metadata, then checking the contents of the corresponding file. If |name| is provided, the name of the file is verified. Artifacts are keyed by metadata rather than by name as the names of files are not guaranteed to be stable.
Sourcepub fn with_matching_artifact<S, F, U>(
self,
metadata: U,
name: Option<S>,
matcher: F,
) -> Self
pub fn with_matching_artifact<S, F, U>( self, metadata: U, name: Option<S>, matcher: F, ) -> Self
Add an artifact matching the exact contents. Artifacts are checked by finding an entry matching the given metadata, then running |matcher| against the contents of the file. If |name| is provided, the name of the file is verified. Artifacts are keyed by metadata rather than by name as the names of files are not guaranteed to be stable.
Sourcepub fn with_directory_artifact<S, U>(
self,
metadata: U,
name: Option<S>,
directory: ExpectedDirectory,
) -> Self
pub fn with_directory_artifact<S, U>( self, metadata: U, name: Option<S>, directory: ExpectedDirectory, ) -> Self
Add a directory based artifact containing the entries described in |directory|.
Sourcepub fn with_start_time(self, millis: u64) -> Self
pub fn with_start_time(self, millis: u64) -> Self
Verify an exact start time.
Sourcepub fn with_run_duration(self, millis: u64) -> Self
pub fn with_run_duration(self, millis: u64) -> Self
Verify an exact run duration.
Sourcepub fn with_any_start_time(self) -> Self
pub fn with_any_start_time(self) -> Self
Verify that a start time is present.
Sourcepub fn with_any_run_duration(self) -> Self
pub fn with_any_run_duration(self) -> Self
Verify that a run duration is present.
Sourcepub fn with_no_start_time(self) -> Self
pub fn with_no_start_time(self) -> Self
Verify that no start time is present.
Sourcepub fn with_no_run_duration(self) -> Self
pub fn with_no_run_duration(self) -> Self
Verify that no run duration is present.