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: StringThe stable identity: suite:<case> or crate:<binary>.
runner: RunnerWhich runner owns it.
source: StringIts own source, repository-relative.
present: boolWhether that source is in this checkout.
reproduce: StringThe 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
impl Clone for TestEvidence
Source§fn clone(&self) -> TestEvidence
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)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TestEvidence
impl Debug for TestEvidence
Source§impl JsonSchema for TestEvidence
impl JsonSchema for TestEvidence
Source§fn schema_id() -> Cow<'static, str>
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
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
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 moreAuto Trait Implementations§
impl Freeze for TestEvidence
impl RefUnwindSafe for TestEvidence
impl Send for TestEvidence
impl Sync for TestEvidence
impl Unpin for TestEvidence
impl UnsafeUnpin for TestEvidence
impl UnwindSafe for TestEvidence
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
Mutably borrows from an owned value. Read more