Skip to content

runner

Structs

  • HeadlessRunner - Runner test harness that does not enter raw terminal mode.
  • ProcessedEventProbe - Probe used by headless tests to observe events processed by the runner.

Enums


firma_tui::control::runner::ControlCrankOutcome

Section titled “firma_tui::control::runner::ControlCrankOutcome”

Enum

Result of one headless runner crank.

Variants:

  • NoEvent - No actionable event was ready.
  • Processed(EventKind) - One event was processed.
  • Quit - The app requested shutdown.

Traits: Copy, Eq

Trait Implementations:

  • Debug
    • fn fmt(self: &Self, f: & mut $crate::fmt::Formatter) -> $crate::fmt::Result
  • Clone
    • fn clone(self: &Self) -> ControlCrankOutcome
  • PartialEq
    • fn eq(self: &Self, other: &ControlCrankOutcome) -> bool

Enum

Coarse category of event processed by the runner.

Variants:

  • Audit - Audit rows were consumed.
  • Input - Keyboard input was consumed.
  • Mouse - Mouse input was consumed.
  • Resize - Terminal resize was consumed.
  • Rewrite - A policy rewrite notification was consumed.

Traits: Copy, Eq

Trait Implementations:

  • Clone
    • fn clone(self: &Self) -> EventKind
  • PartialEq
    • fn eq(self: &Self, other: &EventKind) -> bool
  • Debug
    • fn fmt(self: &Self, f: & mut $crate::fmt::Formatter) -> $crate::fmt::Result

firma_tui::control::runner::HeadlessRunner

Section titled “firma_tui::control::runner::HeadlessRunner”

Struct

Runner test harness that does not enter raw terminal mode.

Tests use this to process one event at a time while injecting fake terminal input, audit rows, and policy rewrite handlers.

Generic Parameters:

  • ‘a

Methods:

  • fn new(policy_dir: Option<PathBuf>, audit_rows: Option<&'a Receiver<AuditRow>>) -> Self - Creates a headless runner with the default policy rewrite queue.
  • fn with_policy_rewrite_handler(policy_dir: Option<PathBuf>, audit_rows: Option<&'a Receiver<AuditRow>>, handler: PolicyRewriteHandler) -> Self - Creates a headless runner with an injected rewrite handler.
  • fn with_observed_policy_rewrite_handler(policy_dir: Option<PathBuf>, audit_rows: Option<&'a Receiver<AuditRow>>, handler: PolicyRewriteHandler) -> (Self, RewriteEventProbe) - Creates a headless runner with an injected rewrite handler and dispatch
  • fn observe_processed_events(self: & mut Self) -> ProcessedEventProbe - Starts recording the events processed by this runner.
  • fn app(self: &Self) -> &App - Returns the current application state.
  • fn sources(self: &Self) -> &Sources<'a> - Returns the event sources consumed by this runner.
  • fn try_crank<impl event::TerminalEventSource, impl FnMut(&Path) -> anyhow::Result<Result<(), EditorError>>>(self: & mut Self, terminal: &impl Trait, open_policy_source: impl Trait) -> anyhow::Result<ControlCrankOutcome> - Processes at most one ready event.
  • fn crank_until<impl event::TerminalEventSource, impl FnMut(&Path) -> anyhow::Result<Result<(), EditorError>>, impl FnMut(&App) -> bool>(self: & mut Self, terminal: &impl Trait, open_policy_source: impl Trait, condition: impl Trait, timeout: Duration) -> anyhow::Result<ControlCrankOutcome> - Cranks until the application reaches a caller-defined condition.
  • fn execute_effects_with_editor<impl FnMut(&Path) -> anyhow::Result<Result<(), EditorError>>>(self: & mut Self, effects: Vec<ControlEffect>, open_policy_source: impl Trait) -> anyhow::Result<()> - Executes command side effects with an injected editor callback.

firma_tui::control::runner::ProcessedEventProbe

Section titled “firma_tui::control::runner::ProcessedEventProbe”

Struct

Probe used by headless tests to observe events processed by the runner.

The probe records events after the runner has dispatched them through the normal app/effect path. Tests that care about ordering can then assert on the same boundary an interactive session uses, instead of synchronizing on helper channels owned by a particular event source.

Methods:

  • fn observed_events(self: &Self) -> anyhow::Result<Vec<EventKind>> - Returns the event kinds observed so far.
  • fn observed_any<impl FnMut(EventKind) -> bool>(self: &Self, predicate: impl Trait) -> anyhow::Result<bool> - Returns true if any processed event satisfies the predicate.
  • fn observed_count<impl FnMut(EventKind) -> bool>(self: &Self, predicate: impl Trait) -> anyhow::Result<usize> - Counts processed events that satisfy the predicate.

Trait Implementations:

  • Debug
    • fn fmt(self: &Self, f: & mut $crate::fmt::Formatter) -> $crate::fmt::Result
  • Default
    • fn default() -> ProcessedEventProbe
  • Clone
    • fn clone(self: &Self) -> ProcessedEventProbe