term_test_support/lib.rs
1//! Shared deterministic test utilities for term-wm crates.
2//!
3//! This crate is a dev-dependency only; nothing in it may run in production.
4//! It exists so the workspace's test suites stop hand-rolling (and drifting)
5//! the same few patterns:
6//!
7//! - [`wait_for`] (sync) and `wait_for_async` (enable the `tokio`
8//! feature): deadline-bounded condition polling.
9//! The repo's testing policy is "no blind sleeps": every wait must observe
10//! real state, not hope that a fixed delay was long enough.
11//! - [`KillOnDrop`]: RAII cleanup so panicking tests cannot leak spawned
12//! processes, PTYs, or other OS resources.
13//! - [`ManualClock`]: a thread-safe virtual clock for deterministic timer
14//! tests. Advancing virtual time only moves the timestamp provider; callers
15//! must still drain the scheduler explicitly.
16//! - [`unique_gateway_name`]: collision-free IPC channel names across
17//! processes and runs.
18
19pub mod clock;
20pub mod env;
21pub mod guard;
22pub mod log_capture;
23pub mod naming;
24#[cfg(feature = "tokio")]
25pub mod poll_async;
26pub mod poll_sync;
27
28pub use clock::ManualClock;
29pub use env::EnvVarGuard;
30pub use guard::KillOnDrop;
31pub use log_capture::{apply_test_logging, test_log_dir, test_log_file};
32pub use naming::unique_gateway_name;
33#[cfg(feature = "tokio")]
34pub use poll_async::wait_for_async;
35pub use poll_sync::{DEFAULT_POLL_INTERVAL, wait_for};