pub enum TermTestError {
Pty(String),
Io(Error),
Timeout {
timeout_ms: u64,
},
Parse(String),
SpawnFailed(String),
ProcessAlreadyRunning,
NoProcessRunning,
InvalidDimensions {
width: u16,
height: u16,
},
}Expand description
Errors that can occur during TUI testing.
This enum represents all possible error conditions in the ratatui_testlib library. Each variant provides specific context about the failure.
§Variants
TermTestError::Pty: Low-level PTY operation failuresTermTestError::Io: Standard I/O errors (file, network, etc.)TermTestError::Timeout: Wait operations that exceed their deadlineTermTestError::Parse: Terminal escape sequence parsing errorsSnapshotMismatch: Snapshot testing failures (requiressnapshot-instafeature)SixelValidation: Sixel graphics validation failures (requiressixelfeature)TermTestError::SpawnFailed: Process spawning failuresTermTestError::ProcessAlreadyRunning: Attempt to spawn when a process is already runningTermTestError::NoProcessRunning: Attempt to interact with a non-existent processTermTestError::InvalidDimensions: Invalid terminal size parametersBevy: Bevy ECS-related errors (requiresbevyfeature)
Variants§
Pty(String)
Error from PTY (pseudo-terminal) operations.
This error occurs when low-level PTY operations fail, such as:
- PTY allocation failures
- PTY configuration errors
- PTY system unavailability
Io(Error)
Standard I/O error.
This wraps std::io::Error and occurs for file operations, network I/O,
or other system-level I/O failures. Automatically converted via From trait.
Timeout
Timeout waiting for a condition.
This error is returned when a wait operation (like TuiTestHarness::wait_for)
exceeds its configured timeout duration. The error includes the timeout value
for debugging purposes.
§Example
use ratatui_testlib::{TuiTestHarness, TermTestError};
use std::time::Duration;
let mut harness = TuiTestHarness::new(80, 24)?
.with_timeout(Duration::from_secs(1));
match harness.wait_for_text("Never appears") {
Err(TermTestError::Timeout { timeout_ms }) => {
eprintln!("Timed out after {}ms", timeout_ms);
}
_ => {}
}Parse(String)
Error parsing terminal escape sequences.
This occurs when the terminal emulator encounters malformed or unexpected escape sequences in the PTY output.
SpawnFailed(String)
Process spawn failed.
This error occurs when attempting to spawn a process in the PTY fails, typically due to:
- Command not found
- Permission denied
- Resource limits exceeded
ProcessAlreadyRunning
Process already running.
This error is returned when attempting to spawn a process while another
process is still running in the PTY. Only one process can run at a time
in a given TestTerminal.
NoProcessRunning
No process running.
This error occurs when attempting to interact with a process (e.g., wait, kill) when no process is currently running in the PTY.
InvalidDimensions
Invalid terminal dimensions.
This error is returned when attempting to create or resize a terminal with invalid dimensions (e.g., zero width or height, or dimensions that exceed system limits).
Trait Implementations§
Source§impl Debug for TermTestError
impl Debug for TermTestError
Source§impl Display for TermTestError
impl Display for TermTestError
Source§impl Error for TermTestError
impl Error for TermTestError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
Source§impl From<Error> for TermTestError
impl From<Error> for TermTestError
Auto Trait Implementations§
impl Freeze for TermTestError
impl !RefUnwindSafe for TermTestError
impl Send for TermTestError
impl Sync for TermTestError
impl Unpin for TermTestError
impl !UnwindSafe for TermTestError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.