| id | 2606240212 |
|---|---|
| title | Add dedicated unit tests for lsp/rename.go helpers |
| status | ✅ |
| model | sonnet |
| summary | internal/lsp/rename.go has 13 unexported helpers without dedicated unit tests. Add a named test for each so the audit policy is satisfied. |
Add a named unit test for each of the 13 unexported
helpers in internal/lsp/rename.go. The 2026-06-24
audit requires it.
Go arch doc §"Tests" requires every production function to have a dedicated test by name. The 2026-06-24 audit (range: 1599c9f..09f22d3) flagged this file.
atxHeadingTextByteRange already has a test.
Three pass-through adapter methods carry exemption
comments. Two helpers were removed from this file.
Both now live in internal/rename with tests.
The 13 helpers below need tests:
isValidRefDefLineheadingPrepareRangeatxHeadingTextStarttrimTrailingHashRunskipLeadingSpacestrimRightSpacetrimmedRangerefDefPrepareRangerefUsePrepareRangerefUseLabelBytes(one partial test exists; add broader coverage)matchLeadingPairmatchTrailingPairbracketPairs
- For each function above, add at least one
TestFunctionNameininternal/lsp/rename_test.go. Drive the helper directly with a byte-slice input. go test ./internal/lsp/...passes.go vet ./internal/lsp/...passes.
Go 1.25 enforces that test names start with an uppercase
letter after Test. The originally planned lowercase
names (TestisValidRefDefLine, etc.) do not compile.
Each test is prefixed with a capital letter or a
disambiguating suffix (e.g. Happy, ATX, Basic).
-
rename_test.gocontains a dedicated test for each helper:TestIsValidRefDefLine,TestHeadingPrepareRangeATX,TestAtxHeadingTextStart,TestTrimTrailingHashRun,TestSkipLeadingSpaces,TestTrimRightSpace,TestTrimmedRange,TestRefDefPrepareRangeHappy,TestRefUsePrepareRangeHappy,TestRefUseLabelBytesAllForms,TestMatchLeadingPairHappy,TestMatchTrailingPairHappy,TestBracketPairsBasic. -
go test ./internal/lsp/...is green. -
mdsmith check .is green.