Skip to content

Latest commit

 

History

History
78 lines (67 loc) · 2.25 KB

File metadata and controls

78 lines (67 loc) · 2.25 KB
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 dedicated unit tests for lsp/rename.go helpers

Goal

Add a named unit test for each of the 13 unexported helpers in internal/lsp/rename.go. The 2026-06-24 audit requires it.

Background

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:

  • isValidRefDefLine
  • headingPrepareRange
  • atxHeadingTextStart
  • trimTrailingHashRun
  • skipLeadingSpaces
  • trimRightSpace
  • trimmedRange
  • refDefPrepareRange
  • refUsePrepareRange
  • refUseLabelBytes (one partial test exists; add broader coverage)
  • matchLeadingPair
  • matchTrailingPair
  • bracketPairs

Tasks

  1. For each function above, add at least one TestFunctionName in internal/lsp/rename_test.go. Drive the helper directly with a byte-slice input.
  2. go test ./internal/lsp/... passes.
  3. go vet ./internal/lsp/... passes.

Acceptance Criteria

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.go contains 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.