Skip to content

refactor(tui): deduplicate ox-tui test helpers into test_support - #1220

Merged
hakula139 merged 1 commit into
mainfrom
refactor/dedup-ox-tui-test-helpers
Dec 6, 2026
Merged

hakula139 merged 1 commit into
mainfrom
refactor/dedup-ox-tui-test-helpers

Conversation

@hakula139

Copy link
Copy Markdown
Member

Summary

  • Consolidate duplicated test-only helpers across crates/ox-tui into a crate-internal #[cfg(test)] pub(crate) mod test_support module (crates/ox-tui/src/test_support.rs), sharing buffer_text, row_text, line_text, key, and type_text.
  • Remove one-line pass-through wrappers (QuitOnRenderBackend::buffer_text, QuitOnRenderBackend::draw_count, and SnapshotBackend::buffer_text) in crates/ox-tui/src/runner/tests.rs so flush and runner/tests/loop_events.rs use buffer_text and struct fields directly.
  • Replace inline for ch in "...".chars() key-dispatch loops in crates/ox-tui/src/render/ui/tests/fullscreen.rs and crates/ox-tui/src/app/tests/input.rs with type_text and key.
  • Keep the refactor scoped to ox-tui test code with zero production behavior changes.

Test plan

  • cargo test -p ox-tui (308 unit tests and 2 preview integration tests passed)
  • cargo clippy --all-targets -- -D warnings (passed across the workspace)
  • nix develop -c run-hooks (all formatting, spelling, and lint hooks passed)

Consolidate duplicated test-only helpers in ox-tui into a crate-internal
#[cfg(test)] pub(crate) mod test_support module and remove one-line
pass-through wrappers on test backends.

- Extract buffer_text, row_text, line_text, key, and type_text into
  crates/ox-tui/src/test_support.rs.
- Remove QuitOnRenderBackend::buffer_text, QuitOnRenderBackend::draw_count,
  and SnapshotBackend::buffer_text in runner/tests.rs so callers use
  buffer_text and struct fields directly.
- Replace inline key-typing loops in render/ui/tests/fullscreen.rs and
  app/tests/input.rs with type_text and key.
@hakula139 hakula139 added refactor Behavior-preserving restructuring area: tui Touches terminal UI rendering, input, or theming labels Dec 6, 2026
@hakula139 hakula139 self-assigned this Dec 6, 2026
@codecov

codecov Bot commented Dec 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@hakula139
hakula139 merged commit ffd12e2 into main Dec 6, 2026
7 checks passed
@hakula139
hakula139 deleted the refactor/dedup-ox-tui-test-helpers branch December 6, 2026 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: tui Touches terminal UI rendering, input, or theming refactor Behavior-preserving restructuring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant