Skip to main content

TestReport

Struct TestReport 

Source
#[non_exhaustive]
pub struct TestReport<'t, FmtError: 't> { pub outcomes: TestOutcomes<'t>, pub duration: Duration, pub fmt_errors: Vec<(FormatError, FmtError)>, }
Expand description

The report produced by running a TestHarness.

TestReport is returned by TestHarness::run. It contains all outcomes of the test run, the total time spent executing the harness, and any errors reported by the formatter.

The recorded duration only covers the time spent inside the harness itself. Any work done before calling run (for example test discovery or data loading) is not included and must be tracked separately if needed.

Formatter errors are collected instead of aborting the run early. This allows test execution to complete even if formatting fails partway through.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§outcomes: TestOutcomes<'t>

Outcomes of all executed tests.

§duration: Duration

Total duration of the test run.

§fmt_errors: Vec<(FormatError, FmtError)>

Errors reported by the formatter.

Each entry contains the formatting stage and the formatter specific error.

Implementations§

Source§

impl<'t, FmtError: 't> TestReport<'t, FmtError>

Source

pub fn exit_code(&self) -> ExitCode

Compute the process exit code for this test report.

The exit code is determined as follows:

This mirrors the behavior of the built in Rust test harness, where formatting errors are treated as fatal.

Trait Implementations§

Source§

impl<'t, FmtError: Debug + 't> Debug for TestReport<'t, FmtError>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'t, FmtError: 't> Termination for TestReport<'t, FmtError>

Source§

fn report(self) -> ExitCode

Is called to get the representation of the value as status code. This status code is returned to the operating system.

Auto Trait Implementations§

§

impl<'t, FmtError> Freeze for TestReport<'t, FmtError>

§

impl<'t, FmtError> !RefUnwindSafe for TestReport<'t, FmtError>

§

impl<'t, FmtError> Send for TestReport<'t, FmtError>
where FmtError: Send,

§

impl<'t, FmtError> Sync for TestReport<'t, FmtError>
where FmtError: Sync,

§

impl<'t, FmtError> Unpin for TestReport<'t, FmtError>
where FmtError: Unpin,

§

impl<'t, FmtError> UnsafeUnpin for TestReport<'t, FmtError>

§

impl<'t, FmtError> !UnwindSafe for TestReport<'t, FmtError>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.