Skip to main content

TestEvidence

Struct TestEvidence 

Source
pub struct TestEvidence {
    pub test: String,
    pub runner: Runner,
    pub source: String,
    pub present: bool,
    pub reproduce: String,
    pub execution: Option<Execution>,
    pub digest_matches: Option<bool>,
    pub proves: Vec<ClaimProof>,
}
Expand description

One test, and what it proves.

The other direction of ClaimEvidence, read from the test’s end: its identity, its source and whether that source is still the one that ran, the command that runs it again, and every claim that names it.

use majordomus_cli::capability::builtin::evidence::TestEvidence;
use majordomus_cli::evidence::TestId;

let id = TestId::of("apps/majordomus-cli/tests/why.rs").unwrap();
let answer = TestEvidence {
    test: id.as_string(),
    runner: id.runner,
    source: id.source(),
    present: true,
    reproduce: id.reproduce(),
    execution: None,
    digest_matches: None,
    proves: Vec::new(),
};
assert_eq!(answer.test, "crate:why");
assert_eq!(answer.reproduce, "cargo test --test why");

// nothing recorded: the two provenance keys are absent rather than null, so "no
// execution" cannot be read as an execution that said nothing
let json = serde_json::to_value(&answer).unwrap();
assert!(json.get("execution").is_none() && json.get("digest_matches").is_none());
assert_eq!(json["proves"], serde_json::json!([]));

Fields§

§test: String

The stable identity: suite:<case> or crate:<binary>.

§runner: Runner

Which runner owns it.

§source: String

Its own source, repository-relative.

§present: bool

Whether that source is in this checkout.

§reproduce: String

The command that runs this one test.

§execution: Option<Execution>

The latest recorded execution, when there is one.

§digest_matches: Option<bool>

Whether the test’s source still hashes to what the execution recorded. None when there is no execution, or the source is not there to hash.

§proves: Vec<ClaimProof>

Every claim that names this test, with the state each is in.

Trait Implementations§

Source§

impl Clone for TestEvidence

Source§

fn clone(&self) -> TestEvidence

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 TestEvidence

Source§

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

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

impl JsonSchema for TestEvidence

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more
Source§

impl Serialize for TestEvidence

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. 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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = 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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more