Skip to content

test(inline): cover BOF and adjacent-hunk fold ranges - #317

Merged
dlyongemallo merged 1 commit into
mainfrom
test_plus_minor_comments
Sep 6, 2026
Merged

test(inline): cover BOF and adjacent-hunk fold ranges#317
dlyongemallo merged 1 commit into
mainfrom
test_plus_minor_comments

Conversation

@dlyongemallo

Copy link
Copy Markdown
Owner

Also minor fixes to comments.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The changes are test-only additions plus accurate doc/comment clarifications, and the new test assertions were verified to match the fold-range implementation.

Pull request overview

This PR strengthens the test suite for the inline diff fold logic in the diff1_inline layout, and makes small documentation/comment clarifications. It adds functional tests covering two previously untested edge cases in update_fold_ranges/foldexpr: a deletion at the very start of file (which anchors virtual lines above line 1) and adjacent hunks whose context ranges touch and get merged. The comment and doc tweaks clarify runtime behavior without changing any production logic.

Changes:

  • Add a test verifying line 1 stays unfolded (and the deleted virt-line anchors above row 0) when the deletion is at BOF.
  • Add a test verifying adjacent hunks' context ranges merge into a single fold range.
  • Update sanitize_cursor_map's doc comment to describe accepted entry shapes, and clarify in doc/diffview.txt that a high foldlevel makes fold_unchanged a no-op.
File summaries
File Description
lua/diffview/tests/functional/inline_diff_spec.lua Adds two expression folds tests covering BOF deletion and adjacent-hunk range merging; assertions match the implementation.
lua/diffview/session.lua Rewords the sanitize_cursor_map doc comment to describe the accepted bare/wrapped entry shapes, consistent with the code.
doc/diffview.txt Clarifies that setting foldlevel high enough to keep all folds open makes fold_unchanged a no-op; the foldlevel tag reference is valid.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@dlyongemallo
dlyongemallo merged commit 29f3bd6 into main Sep 6, 2026
9 checks passed
@dlyongemallo
dlyongemallo deleted the test_plus_minor_comments branch September 6, 2026 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants