Skip to content

[Repo Assist] test: add coverage for ensure_selection_visible branches and csv_escape#152

Draft
github-actions[bot] wants to merge 1 commit intomainfrom
repo-assist/test-viewport-csv-2026-04-25-e3691005dbb7fe2a
Draft

[Repo Assist] test: add coverage for ensure_selection_visible branches and csv_escape#152
github-actions[bot] wants to merge 1 commit intomainfrom
repo-assist/test-viewport-csv-2026-04-25-e3691005dbb7fe2a

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

🤖 This PR was created by Repo Assist, an automated AI assistant.

What

Adds 6 targeted tests to src/app.rs that complete branch coverage for two existing functions:

ensure_selection_visible (3 new tests)

Previously only the scroll-down path was tested. This PR adds:

Test Branch covered
ensure_selection_visible_scrolls_viewport_up selected < offset → scroll up
ensure_selection_visible_already_visible_is_noop selection in-view → offset unchanged
(existing) ensure_selection_visible_scrolls_viewport_down selected ≥ offset + viewport → scroll down

csv_escape (4 new tests)

The csv_escape helper is a pure function called in the export path but had no direct unit tests:

Test Case
csv_escape_plain_string_is_unchanged no special chars → pass-through
csv_escape_string_with_comma_is_quoted comma → wrap in "..."
csv_escape_embedded_quote_is_doubled """ inside wrapping quotes
csv_escape_newline_triggers_quoting \n → wrap in "..."

Test Status

cargo test       → 236 passed (was 230)
cargo clippy     → clean
cargo fmt --check → clean

No production code changed.

Note

🔒 Integrity filter blocked 1 item

The following item were blocked because they don't meet the GitHub integrity level.

To allow these resources, lower min-integrity in your GitHub frontmatter:

tools:
  github:
    min-integrity: approved  # merged | approved | unapproved | none

Generated by Repo Assist · ● 3.5M ·

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@cbb46ab386962aa371045839fc9998ee4e97ca64

Add tests for three previously uncovered code paths in app.rs:

- ensure_selection_visible_scrolls_viewport_up: selection above the
  visible window (selected < offset) was the only un-exercised branch
  of ensure_selection_visible.
- ensure_selection_visible_already_visible_is_noop: verifies the
  function leaves offset unchanged when the selection is in-view.
- csv_escape_*: four unit tests for the pure csv_escape helper
  (plain string, comma, embedded quote, newline), which had no
  direct tests despite being called in the CSV export path.

230 → 236 tests; all passing.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants