Skip to main content

FileSystemContractSuite

Struct FileSystemContractSuite 

Source
pub struct FileSystemContractSuite<'a> { /* private fields */ }
Expand description

Runs synchronous provider contracts against one isolated fixture.

§Type Parameters

  • 'a - Lifetime of the borrowed provider fixture.

§Examples

use qubit_fs_testkit::{FileSystemContract, FileSystemContractSuite};

let fixture = RustdocSyncFixture::new();
let mut suite = FileSystemContractSuite::new(&fixture);
suite.run_contract(FileSystemContract::Properties);
assert!(!suite.run().was_interrupted());

Implementations§

Source§

impl<'a> FileSystemContractSuite<'a>

Source

pub fn finish(&mut self)

Cleans resources created by individually executed contract phases.

The first cleanup attempt closes resource preparation and all run entry points, even when cleanup fails. Call finish again to retry cleanup; create a fresh fixture and suite for another run.

§Panics

Panics when a recorded resource cannot be inspected or deleted.

Source

pub fn path(&self, relative: &str) -> Path

Resolves a fixture path or identifies the contract that could not set up.

§Parameters
  • relative - Resource name relative to the current contract phase.
§Returns

The provider path mapped by the fixture.

§Panics

Panics when the fixture cannot map the generated relative name.

Source

pub fn capable(&self, capability: FileSystemCapability) -> bool

Returns whether the immutable snapshot declares a capability.

§Parameters
  • capability - Capability to query in the captured snapshot.
§Returns

true when the provider advertises the capability.

Source

pub fn required_seed( &mut self, relative: &str, bytes: &[u8], contract: &str, ) -> Path

Seeds a resource and makes support mandatory for the requested capability.

§Parameters
  • relative - Resource name relative to the current contract phase.
  • bytes - Exact content to publish.
  • contract - Contract label used in failure diagnostics.
§Returns

The provider path of the seeded file.

§Panics

Panics when cleanup has started, fixture setup fails, or the required seed hook is unsupported. A failed or interrupted cleanup attempt does not reopen resource preparation.

Source

pub fn seed(&mut self, relative: &str, bytes: &[u8]) -> FixtureSupport<Path>

Delegates out-of-band resource preparation to the fixture.

§Parameters
  • relative - Resource name relative to the current contract phase.
  • bytes - Exact content to publish.
§Returns

The fixture’s support result and seeded path, when available.

§Panics

Panics when cleanup has started or provider-specific fixture setup returns an error. A failed cleanup attempt does not reopen preparation.

Source§

impl<'a> FileSystemContractSuite<'a>

Source

pub fn new(fixture: &'a dyn FileSystemFixture) -> Self

Creates a stateful suite borrowing one isolated provider fixture.

§Parameters
  • fixture - Isolated provider fixture exercised by the suite.
§Returns

A suite with a fresh context and captured property snapshot.

Source

pub const fn run(&self) -> &ContractRun

Returns the result retained by this suite, including a failed session.

Source

pub fn report(&self) -> &ContractReport

Returns the report currently accumulated by this suite.

Source

pub fn run_all(&mut self) -> &ContractRun

Executes all phases once and retains both execution and cleanup failures.

Returns a lifecycle failure without running checks if cleanup has already started. Use a fresh fixture and suite for another run.

§Returns

The retained execution result after the suite finishes.

Source

pub fn run_contract(&mut self, contract: FileSystemContract) -> &ContractRun

Executes one phase once and retains its result in the suite.

Returns a lifecycle failure without running checks if cleanup has already started. Use a fresh fixture and suite for another run.

§Parameters
  • contract - Contract phase to execute.
§Returns

The retained execution result after the phase finishes.

Source

pub fn run_check(&mut self, id: ContractCheckId) -> &ContractRun

Executes one selected check in a fresh session and retains its cleanup result.

Returns a lifecycle failure without running checks if cleanup has already started. Use a fresh fixture and suite for another run.

§Parameters
  • id - Check identity to execute.
§Returns

The retained execution result after the check finishes.

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