Repository navigation
refactor(tui): deduplicate ox-tui test helpers into test_support - #1220
Merged
Merged
Conversation
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.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
crates/ox-tuiinto a crate-internal#[cfg(test)] pub(crate) mod test_supportmodule (crates/ox-tui/src/test_support.rs), sharingbuffer_text,row_text,line_text,key, andtype_text.QuitOnRenderBackend::buffer_text,QuitOnRenderBackend::draw_count, andSnapshotBackend::buffer_text) incrates/ox-tui/src/runner/tests.rssoflushandrunner/tests/loop_events.rsusebuffer_textand struct fields directly.for ch in "...".chars()key-dispatch loops incrates/ox-tui/src/render/ui/tests/fullscreen.rsandcrates/ox-tui/src/app/tests/input.rswithtype_textandkey.ox-tuitest 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)