test(lsp/rename): add dedicated unit tests for 13 unexported helpers - #692
Merged
Conversation
Each helper in internal/lsp/rename.go now has at least one named test driven directly with byte-slice input, satisfying the audit policy from the 2026-06-24 architecture audit (plan/2606240212). Go 1.25 enforces uppercase-first test names, so the originally planned TestisValidRefDefLine-style names are replaced with PascalCase equivalents (TestIsValidRefDefLine, TestAtxHeadingTextStart, etc.). The plan's acceptance criteria are updated to reflect this. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JUK9cuin8PW6MjnK2JTxLb
- Always check i return value in TestAtxHeadingTextStart even when !ok - Use concrete values 3,3 in TestTrimmedRange all-whitespace case - Assert Range coordinates in TestRefUsePrepareRangeHappy - Assert start=0,end=0 in TestRefUseLabelBytesAllForms no-match cases Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JUK9cuin8PW6MjnK2JTxLb
- Add cursor=5 (at ] of text pair) and cursor=6 (at [ of label pair) boundary cases to TestRefUseLabelBytesAllForms to pin the >/< boundary semantics of the cursorByte < pr.open || cursorByte > pr.close guard - Fix PLAN.md catalog: 2606240212 row was 🔳 (in-progress) but plan file is ✅ (complete); regenerate via mdsmith fix Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JUK9cuin8PW6MjnK2JTxLb
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files
☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…AllForms Double-space alignment before inline // comments is not gofmt-canonical; collapse to single space so golangci-lint gofmt check passes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JUK9cuin8PW6MjnK2JTxLb
Owner
Author
|
🟢 Merge Queue — picked up This PR is in the queue and will be batched with other Next: No action needed — you'll get another comment when CI starts on the batch. View merge queue run. |
Owner
Author
|
🔵 Merge Queue — CI running Merged into batch branch Next: No action needed — you'll be notified when CI completes. |
Owner
Author
|
✅ Merge Queue — merged This PR landed on Next: Done — nothing more to do here. |
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
TestXxxfor each of the 13 unexported helpers ininternal/lsp/rename.go(isValidRefDefLine,headingPrepareRange,atxHeadingTextStart,trimTrailingHashRun,skipLeadingSpaces,trimRightSpace,trimmedRange,refDefPrepareRange,refUsePrepareRange,refUseLabelBytes,matchLeadingPair,matchTrailingPair,bracketPairs), satisfying the 2026-06-24 arch audit requirementTest; all names use an uppercase first letter or disambiguating suffix (ATX,Happy,Basic,AllForms)/code-review xhigh: asserts concrete return values for all-whitespacetrimmedRange, verifiesRangecoordinates inrefUsePrepareRange, unconditionally checksiinatxHeadingTextStarttable loop, pins zero sentinel inrefUseLabelBytesno-match path, and addspr.close/pr.openboundary casesTest plan
go test ./internal/lsp/...greengo vet ./internal/lsp/...greenmdsmith check .green (514 files, 0 failures)🤖 Generated with Claude Code
https://claude.ai/code/session_01JUK9cuin8PW6MjnK2JTxLb
Generated by Claude Code