Skip to main content

Module test_api

Module test_api 

Source
Expand description

Test-only observation API for the editor.

The semantic test suite (under tests/semantic/) binds only to this module — it must never reach into crate::app::Editor, crate::model::*, or crate::view::* directly. That keeps the test/production contract explicit and one-directional: production internals can be refactored freely, the test API is the only thing that has to stay stable.

See docs/internal/e2e-test-migration-design.md for the full rationale.

§Layers

Phase 2 (current) exposes only Class A — pure state observables: dispatch, dispatch_seq, buffer_text, primary_caret, carets, selection_text. Layout (RenderSnapshot) and styled-frame (StyledFrame) observables are reserved for Phase 3+ and intentionally not present here yet — adding them is a design decision that should be made when the first theorem demanding them is written.

§Determinism

carets() returns cursors in ascending byte-position order so that tests don’t depend on HashMap iteration order (cursors are stored in a hashmap internally).

Re-exports§

pub use crate::input::keybindings::Action;

Structs§

Caret
A test-side projection of crate::model::cursor::Cursor.
ModalSnapshot
Test-side projection of the editor’s popup stack. Captures only the fields scenario tests assert on — kind, title, items, selection — so internal popup struct refactors don’t break tests.
PopupView

Traits§

EditorTestApi
The single observation surface for semantic theorem tests.