pub struct TestResult { /* private fields */ }Expand description
Outcome of a TestHarness::run invocation.
Holds the raw RunResult produced by the app, plus convenience
accessors and assertion helpers oriented at text output.
Implementations§
Source§impl TestResult
impl TestResult
Sourcepub fn outcome(&self) -> &RunResult
pub fn outcome(&self) -> &RunResult
Returns the raw RunResult for cases where the structured
accessors aren’t enough.
Sourcepub fn stdout(&self) -> &str
pub fn stdout(&self) -> &str
Returns the rendered text output, or "" for Silent / Binary /
NoMatch.
Sourcepub fn is_handled(&self) -> bool
pub fn is_handled(&self) -> bool
Returns true if the run produced text output.
Sourcepub fn is_no_match(&self) -> bool
pub fn is_no_match(&self) -> bool
Returns true if no handler matched the argv.
Sourcepub fn binary(&self) -> Option<(&[u8], &str)>
pub fn binary(&self) -> Option<(&[u8], &str)>
If the run produced binary output, returns the bytes and suggested filename.
Sourcepub fn assert_success(&self)
pub fn assert_success(&self)
Panics unless the run ended in a successful dispatch
(RunResult::Handled, RunResult::Silent, or RunResult::Binary).
RunResult::NoMatch triggers a panic.
Sourcepub fn assert_no_match(&self)
pub fn assert_no_match(&self)
Panics unless the run ended in RunResult::NoMatch.
Sourcepub fn assert_stdout_contains(&self, needle: &str)
pub fn assert_stdout_contains(&self, needle: &str)
Panics unless stdout contains needle.
Sourcepub fn assert_stdout_eq(&self, expected: &str)
pub fn assert_stdout_eq(&self, expected: &str)
Panics unless stdout equals expected exactly.
Auto Trait Implementations§
impl Freeze for TestResult
impl !RefUnwindSafe for TestResult
impl Send for TestResult
impl Sync for TestResult
impl Unpin for TestResult
impl UnsafeUnpin for TestResult
impl !UnwindSafe for TestResult
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more