Skip to main content

Crate term_test_support

Crate term_test_support 

Source
Expand description

Shared deterministic test utilities for term-wm crates.

This crate is a dev-dependency only; nothing in it may run in production. It exists so the workspace’s test suites stop hand-rolling (and drifting) the same few patterns:

  • wait_for (sync) and wait_for_async (enable the tokio feature): deadline-bounded condition polling. The repo’s testing policy is “no blind sleeps”: every wait must observe real state, not hope that a fixed delay was long enough.
  • KillOnDrop: RAII cleanup so panicking tests cannot leak spawned processes, PTYs, or other OS resources.
  • ManualClock: a thread-safe virtual clock for deterministic timer tests. Advancing virtual time only moves the timestamp provider; callers must still drain the scheduler explicitly.
  • unique_gateway_name: collision-free IPC channel names across processes and runs.

Re-exports§

pub use clock::ManualClock;
pub use env::EnvVarGuard;
pub use guard::KillOnDrop;
pub use log_capture::apply_test_logging;
pub use log_capture::test_log_dir;
pub use log_capture::test_log_file;
pub use naming::unique_gateway_name;
pub use poll_sync::DEFAULT_POLL_INTERVAL;
pub use poll_sync::wait_for;

Modules§

clock
A thread-safe virtual clock for deterministic timer tests.
env
Centralized RAII environment-variable mutation for tests.
guard
Generic RAII cleanup guard for test-owned resources.
log_capture
Per-run diagnostic log capture for test harnesses.
naming
Collision-free IPC channel names for tests.
poll_sync
Deadline-bounded synchronous condition polling.