[Repo Assist] test: add 11 unit tests for word_wrap in ui.rs#166
Draft
github-actions[bot] wants to merge 1 commit intomainfrom
Draft
[Repo Assist] test: add 11 unit tests for word_wrap in ui.rs#166github-actions[bot] wants to merge 1 commit intomainfrom
github-actions[bot] wants to merge 1 commit intomainfrom
Conversation
word_wrap is a non-trivial algorithm (word-boundary wrapping with mid-word force-break for overlong tokens, multi-paragraph handling, and CJK display-width awareness) that had zero test coverage. New tests cover: - empty string → single empty line - single word within/at limit - multi-word line that fits exactly - word-boundary wrap - three-word wrap - zero max_width special case - single long word force-break - very long word split into multiple lines - multi-paragraph preservation - round-trip word integrity at max=15 - CJK double-width character wrapping 231 → 242 tests passing. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Apr 29, 2026
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.
🤖 This PR was created by Repo Assist, an automated AI assistant.
What
Adds 11 targeted unit tests to
src/ui.rsfor theword_wrapfunction, which previously had zero test coverage despite being a non-trivial algorithm used to wrap package descriptions in the detail panel.Why
word_wraphandles several distinct code paths:max_widthmax_widthmax_width == 0None of these were exercised by any test.
Tests added
word_wrap_empty_string_returns_one_empty_line[""]word_wrap_single_word_within_limitword_wrap_single_line_fits_exactlyword_wrap_wraps_at_word_boundaryword_wrap_three_words_wrap_correctlyword_wrap_zero_max_returns_text_as_single_linemax_width == 0branchword_wrap_long_word_force_breaksword_wrap_very_long_word_splits_into_multiple_linesword_wrap_preserves_paragraph_breaksword_wrap_each_line_is_within_max_widthword_wrap_cjk_respects_display_widthTest Status