Skip to main content

FileReport

Struct FileReport 

Source
pub struct FileReport {
    pub path: PathBuf,
    pub check: CheckInfo,
    pub error: Option<String>,
    pub passed: usize,
    pub failed: usize,
    pub failures: Vec<String>,
    pub file_level: bool,
    pub tests: Vec<TestResult>,
    pub duration_ms: f64,
    pub snapshots_written: Vec<String>,
    pub snapshots_updated: Vec<String>,
    pub coverage: Vec<(String, Vec<usize>)>,
}
Expand description

Outcome of one test file.

Fields§

§path: PathBuf

The test file this is about, as it was discovered or named on the command line.

§check: CheckInfo

What checking it found. A file that does not type-check still gets a report — with this carrying the errors and no tests below it — rather than being dropped, so a run says which files it could not get to.

§error: Option<String>

Runtime error outside any test (e.g. the file itself raised).

§passed: usize

Tests the library reported as passing.

§failed: usize

Tests it reported as failing. ok is false while this is non-zero, and the run’s exit code is the sum of it over every file.

§failures: Vec<String>

One message per failure, already formatted by the library — the runner owns no assertion and so has nothing of its own to say about why one failed.

§file_level: bool

true when no test library was used and the verdict is file-level.

§tests: Vec<TestResult>

Per-test outcomes when the library reports them (htl.test does).

§duration_ms: f64

Wall time for the whole file: check, load, and every test.

§snapshots_written: Vec<String>

Snapshot files created on this run (first to_match_snapshot of a name).

§snapshots_updated: Vec<String>

Snapshot files rewritten because update_snapshots was set.

§coverage: Vec<(String, Vec<usize>)>

With coverage: (chunk source as Lua names it, executed lines).

Implementations§

Source§

impl FileReport

Source

pub fn ok(&self) -> bool

Whether this file is a pass: it checked, it did not raise outside a test, and no test failed. The three are separate fields because a reporter says which of them went wrong, and one answer is what an exit code needs.

Trait Implementations§

Source§

impl Clone for FileReport

Source§

fn clone(&self) -> FileReport

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FileReport

Source§

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

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

impl Default for FileReport

Source§

fn default() -> FileReport

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> MaybeSend for T

Source§

impl<T> MaybeSync for T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.