pub struct Verdict { /* private fields */ }Expand description
Pointwise-claim accumulator.
Carries an AssertResult under the hood and exposes the same
outcome() / outcomes / stats shape on completion. Build via
Verdict::new or Assert::verdict; finish with
Verdict::into_result.
// Empty verdict — no claims, passes.
let v = Assert::default_checks().verdict();
let r = v.into_result();
assert!(r.is_pass());Implementations§
Source§impl Verdict
impl Verdict
Sourcepub fn new() -> Self
pub fn new() -> Self
Empty accumulator with no Assert attached. Use when a test
is composing pointwise claims and does not care about the
scheduler-level threshold layer.
Sourcepub fn with_assert(assert: Assert) -> Self
pub fn with_assert(assert: Assert) -> Self
Empty accumulator carrying assert for downstream lookup.
Reached via Assert::verdict; not part of the test author’s
usual entry point.
Sourcepub fn with_log_passes(self, on: bool) -> Self
pub fn with_log_passes(self, on: bool) -> Self
Toggle positive-confirmation logging. When on, every
comparator’s pass arm emits a tracing::info! event naming
the claim and the values compared, visible to operators
running tests with --nocapture. Off by default — the
pass path stays allocation-free.
Initial value reads KTSTR_LOG_PASSES (any value other than
"" or "0" enables) so a debugging session can flip the
flag from the shell without touching test source.
Programmatic override always wins over the env var; chain
.with_log_passes(false) to silence a single verdict even
when the env var is set.
Sourcepub fn log_passes(&self) -> bool
pub fn log_passes(&self) -> bool
Read the current positive-confirmation logging flag.
Sourcepub fn note(&mut self, msg: impl Into<String>) -> &mut Self
pub fn note(&mut self, msg: impl Into<String>) -> &mut Self
Append an informational note to the underlying AssertResult
without altering the verdict. Mirrors AssertResult::note.
Sourcepub fn note_value(
&mut self,
key: impl Into<String>,
value: impl Into<NoteValue>,
) -> &mut Self
pub fn note_value( &mut self, key: impl Into<String>, value: impl Into<NoteValue>, ) -> &mut Self
Attach a structured (key, value) measurement to the
underlying AssertResult::measurements map without
altering the verdict. Mirrors AssertResult::note_value.
Use when a test wants to surface a programmatically
consumable measurement (e.g. verdict.note_value("max_wchar", 12345i64)) alongside pass/fail claims, so sidecar parsers
and stats compare dashboards can read the typed value
without re-grepping details.
Sourcepub fn skip(&mut self, reason: impl Into<String>) -> &mut Self
pub fn skip(&mut self, reason: impl Into<String>) -> &mut Self
Mark the verdict as skipped with the supplied reason. Pushes
one Outcome::Skip carrying a DetailKind::Skip detail
onto the outcome stream. Use when a precondition is missing
and the scenario cannot run.
Prior outcomes are preserved: a verdict whose earlier claim
failed and then transitions to skip stays failed. The merge
lattice (Fail > Inconclusive > Pass > Skip) keeps any
recorded Outcome::Fail dominant, so once a claim records
a real failure, a later skip cannot mask it. Distinct from
AssertResult::skip, which is a CONSTRUCTOR producing a
fresh skipped envelope from no prior state.
Sourcepub fn skip_if(&mut self, cond: bool, reason: impl Into<String>) -> &mut Self
pub fn skip_if(&mut self, cond: bool, reason: impl Into<String>) -> &mut Self
Conditional skip: skip with reason when cond is true; no-op
otherwise. Convenience over if cond { v.skip(reason); }.
Sourcepub fn inconclusive(&mut self, detail: AssertDetail) -> &mut Self
pub fn inconclusive(&mut self, detail: AssertDetail) -> &mut Self
Mark the verdict as inconclusive with the supplied detail.
Pushes one Outcome::Inconclusive carrying detail onto
the outcome stream. Use when the gate APPLIED (preconditions
were met) but the signal needed to evaluate it was absent —
e.g. a ratio whose denominator is INSTRUMENT-derived and
happened to be zero (no migrations observed), so the
comparison cannot be performed and the verdict is neither
pass nor fail.
Boundary with Self::skip: Inconclusive = the gate
applied but the signal was absent; Skip = the gate’s
precondition was unmet so the gate did not apply at all.
Boundary with comparator-driven record_fail: Inconclusive
= the denominator is INSTRUMENT-derived (a measurement that
happened to be zero); Fail = the denominator is
POLICY-derived (a configured expectation that must hold —
see the Outcome doc’s MemPolicy::Bind carve-out).
Prior outcomes are preserved: a verdict whose earlier claim
failed and then transitions to inconclusive stays failed
per the merge lattice (Fail > Inconclusive > Pass > Skip).
Sourcepub fn inconclusive_if(&mut self, cond: bool, detail: AssertDetail) -> &mut Self
pub fn inconclusive_if(&mut self, cond: bool, detail: AssertDetail) -> &mut Self
Conditional inconclusive: record detail when cond is
true; no-op otherwise. Convenience over
if cond { v.inconclusive(detail); }. Mirrors
Self::skip_if.
Sourcepub fn merge(&mut self, other: AssertResult) -> &mut Self
pub fn merge(&mut self, other: AssertResult) -> &mut Self
Fold an external AssertResult into this verdict. Useful when
a test combines pointwise claims with the result of an upstream
assert_* call (e.g. assert_not_starved). Mirrors
AssertResult::merge semantics — other.outcomes are
appended to this verdict’s outcome stream, so the merge
lattice (Fail > Inconclusive > Pass > Skip) folds across
both sides; notes/measurements are concatenated;
aggregate stats adopt the worst per dimension.
Sourcepub fn is_pass(&self) -> bool
pub fn is_pass(&self) -> bool
True iff the folded outcome is Outcome::Pass. Per
AssertResult::is_pass, this requires no recorded
Fail, no recorded Inconclusive, AND the outcome
stream is either empty or contains at least one
non-Skip claim. An empty verdict (no claims recorded)
folds to Pass; an all-Skip stream returns false
here — the verdict didn’t fail, but it also didn’t
actually run. Read-only. Name matches the rest of the
4-state vocabulary across AssertResult::is_pass /
crate::test_support::SidecarResult::is_pass /
Outcome::is_pass / Self::is_pass /
MonitorVerdict::is_pass (in the monitor module,
which is pub(crate)) / GauntletRow::is_pass (in
the stats module, which is pub(crate)). The methods
are pub; only the containing modules are pub(crate),
so the bare rustdoc links don’t resolve from this pub
item — the code spans on those two are bare to avoid a
private intra-doc-link warning.
Note: a verdict that recorded one or more Outcome::Inconclusive
outcomes returns false here even though it did not record a
hard failure. Use Verdict::into_result + AssertResult::outcome
when callers need to distinguish Pass from Inconclusive from Fail.
Sourcepub fn is_fail(&self) -> bool
pub fn is_fail(&self) -> bool
True iff any recorded outcome is Outcome::Fail. Mirrors
AssertResult::is_fail — any Fail in the outcome stream
dominates under the Fail > Inconclusive > Pass > Skip
lattice, so a single failed claim makes this true regardless
of how many later inconclusive or pass claims followed.
Sourcepub fn is_inconclusive(&self) -> bool
pub fn is_inconclusive(&self) -> bool
True iff any recorded outcome is Outcome::Inconclusive and
no Outcome::Fail was recorded. Mirrors
AssertResult::is_inconclusive. Fail dominates: a verdict
with both Fail and Inconclusive outcomes returns false here
and true from Self::is_fail.
Sourcepub fn is_skip(&self) -> bool
pub fn is_skip(&self) -> bool
True iff the outcome stream is non-empty and every recorded
outcome is Outcome::Skip. Mirrors AssertResult::is_skip.
An empty verdict (the merge identity) returns false here — it
is reported as Pass via Self::is_pass, not Skip.
Sourcepub fn detail_count(&self) -> usize
pub fn detail_count(&self) -> usize
Number of recorded outcomes carrying a payload (Fail + Inconclusive + Skip) — i.e. recorded diagnostics so far. Pass markers don’t count.
Sourcepub fn assert(&self) -> Option<&Assert>
pub fn assert(&self) -> Option<&Assert>
Read the Assert threshold config attached at construction
time, if any. None when the verdict was built via
Verdict::new (no threshold layer).
Sourcepub fn into_result(self) -> AssertResult
pub fn into_result(self) -> AssertResult
Consume the accumulator and return the merged AssertResult.
Terminal — chain .into_result() at the end of a fluent claim
sequence to feed the result into the test return value.
Sourcepub fn into_anyhow_or_log(self) -> Result<()>
pub fn into_anyhow_or_log(self) -> Result<()>
Terminal post_vm-callback helper. Equivalent to
self.into_result().into_anyhow_or_log() — drains the
accumulator, logs every crate::assert::InfoNote via
tracing::info!, and bails on any accumulated failure
(with all failure details concatenated). See
AssertResult::into_anyhow_or_log for the full contract.
Use this to collapse a typical post_vm callback’s terminal
let r = v.into_result(); … bail/log loop boilerplate
into a single chainable call.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Verdict
impl RefUnwindSafe for Verdict
impl Send for Verdict
impl Sync for Verdict
impl Unpin for Verdict
impl UnwindSafe for Verdict
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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