Skip to main content

RuleOutcome

Enum RuleOutcome 

pub enum RuleOutcome {
    Ran,
    Skipped {
        capability: &'static str,
        reason: &'static str,
    },
}
Expand description

What a conformance rule did.

There is no Failed variant, and its absence is deliberate: a failing rule panics. That is what fails the enclosing #[test], and it is what gives libtest a message, a location and a backtrace to print. Threading failure back as a value would buy a second, worse reporting channel.

The #[must_use] is what turns “an emitter must report the skip” from prose into a build failure. A caller-supplied emitter that drops the outcome warns, and CI denies warnings.

Variants§

§

Ran

The rule ran, and every assertion in it held.

§

Skipped

The rule required a capability this fixture declines, and did nothing.

Fields

§capability: &'static str

The associated const that was declined, as its own identifier — "REOPEN" on a Fixture, "RESET_REFUSAL" on a ProjectionFixture — so a reader is told the name of the thing they can go and change rather than a paraphrase of it. Both fixture traits report into this one field, and a test asserting on a skip can therefore spell the constant’s name directly.

Two values here are not fixture consts and are spelled with their path for that reason: NO_STORE_LIMITS and NO_BATCH_READ_PATH.

§reason: &'static str

The fixture’s stated reason, from Capability::declined — except for the two testkit-written reasons, NO_CEILING_REASON and NO_BATCH_READ_PATH_REASON, which each say on their own page why the fixture is not asked to phrase it.

Implementations§

§

impl RuleOutcome

pub fn skip_line(self, rule: &str) -> Option<String>

The one line worth showing a human, or None when there is nothing to say.

This is the target-independent half of reporting, and it is public because where a line goes is a property of the harness rather than of the rule. report writes it to stdout, which is right on every target that has one; emit_wasm routes it to console.log, because wasm32-unknown-unknown does not (see report). A caller-supplied emitter for a runtime the testkit has never heard of — CF-23’s extension point — picks its own sink from here.

The returned Option is itself #[must_use], so the obligation to report survives one step further down the chain.

pub fn report(self, rule: &str)

Reports this outcome to stdout, under the name of the rule that produced it.

Prints nothing for Ran — libtest already reports a test that passed — and one SKIP line for a skip.

§Two honest limitations, one per target

Natively, libtest suppresses a passing test’s stdout unless it is run with --show-output (or --nocapture), which is why the gate passes it. That makes the line reachable by a human; it does not make anyone read it. The machine-checked half of the obligation is the mutation_coverage::capability_skips_are_reported meta-test in crates/happenstance-testkit/tests/mutation_coverage.rs, which asserts on RuleOutcome values rather than on stdout — and not this function.

On wasm32-unknown-unknown this function is a no-op, measured rather than assumed: the suite was run under wasm-bindgen-test-runner with --nocapture and no SKIP line appeared. That target’s std has no host stdio to write to and declares no import that would give it one, and wasm-bindgen-test hooks console.* rather than println!. So the wasm emitter does not call this; it calls skip_line and hands the result to console_log!, which the runner does capture.

Trait Implementations§

§

impl Clone for RuleOutcome

§

fn clone(&self) -> Self

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
§

impl Copy for RuleOutcome

§

impl Debug for RuleOutcome

§

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

Formats the value using the given formatter. Read more
§

impl Eq for RuleOutcome

§

impl PartialEq for RuleOutcome

§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
§

impl StructuralPartialEq for RuleOutcome

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> 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.

§

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

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V