Skip to main content

Module testing

Module testing 

Source
Expand description

Public testing harness for driving the application model without side effects.

Prefer TestUi over reaching for App, Renderer, or a raw Terminal<TestBackend>: it owns all of them and routes input, ACP events, task settling, and drawing through the same seams the event loop uses.

Re-exports§

pub use crate::renderer::RenderStats;

Structs§

BackendStats
Backend work since the last CountingBackend::take_stats: how much a frame pushed at the terminal. Because ratatui diffs buffers before flushing, cells_drawn counts only cells that actually changed — a frame that repaints a settled screen costs nothing.
CountingBackend
A TestBackend that counts what rendering pushes at it, for tests that bound rendering work instead of timing it.
FakeExecutor
A deterministic command runner for integration tests.
FakeFilesystem
An in-memory filesystem used by command-oriented tests.
FakeGit
A small stateful Git model. It keeps working-tree, index, and committed snapshots separate so staging and discarding have observable semantics.
FakeGitFile
RecordingBackend
TestTerminal
Deterministic terminal wrapper used by focused golden tests.
TestUi
A whole UI scenario: the app, the renderer that owns its scrollback, the terminal it draws into, and the receiver for the commands the app sends.
TestUiBuilder
Builds a TestUi: the terminal dimensions plus every app-scenario option a test cares about. Defaults match a plain make_app()-style scenario.

Enums§

BackendEvent
A backend that records terminal history operations without involving a real terminal. It is intentionally small: only operations with an observable presentation contract are recorded.
StreamContent
The shape of message TestUi::stream_message streams.

Traits§

BuffersReader
A backend whose screen and scrollback buffers can be read back, so a TestUi built on it can expose viewport/history/conversation text.

Functions§

assert_buffer_eq
Asserts buffer’s visible text matches expected row-by-row after trimming trailing spaces, panicking on the first mismatched line with the full buffer dumped.
buffer_text
chunk_message
has_cell
Whether any cell drawn with symbol satisfies predicate.
line_text
row_containing
row_text
rows_with_background
How many rows contain at least one cell with background.
session_update
text_chunk
thought_chunk
tool_completed