| id | 2606240213 |
|---|---|
| title | Add dedicated unit tests for export.go helpers and two small rename helpers |
| status | ✅ |
| model | sonnet |
| summary | internal/export/export.go has 11 unexported helpers without dedicated tests. Two small helpers from concisenessscoring and rename are batched here. Flagged by the 2026-06-24 audit. |
Add named unit tests for 11 unexported helpers in
internal/export/export.go. Two small helpers from
other files are batched here as well.
Go arch doc §"Tests" requires every production function to have a dedicated test by name. The 2026-06-24 audit (range: 1599c9f..09f22d3) flagged all three files.
Functions without a dedicated test:
selectDirectives— pick rules with directivesallDirectiveNames— list built-in directive namesregenerate— rebuild generated sectionshydrate— copy diagnostics to original filecheckStaleness— flag stale generated bodiesinGeneratedRange— check if line is generatedstripDirectives— remove directive PI markerspiLineRange— compute PI block line rangeoverlapsAny— check if[from,to]hits line setemitLines— emit non-stripped lines to buffernormalizeBlankLines— collapse blank-line runs
countClassifierTokens— count tokens without allocating a regex match per call
contentBlockLines— lines inside code blocks
- Add a
TestFunctionNameininternal/export/export_test.gofor each of the 11 export helpers above. - Add
TestcountClassifierTokensininternal/rules/concisenessscoring/rule_test.go. - Add
TestcontentBlockLinesininternal/rename/rename_test.go. go test ./internal/export/...passes.go test ./internal/rules/concisenessscoring/...passes.go test ./internal/rename/...passes.
-
helpers_test.go(package export) containsTestSelectDirectives,TestAllDirectiveNames,TestRegenerate,TestHydrate,TestCheckStaleness,TestInGeneratedRange,TestStripDirectives,TestPiLineRange,TestOverlapsAny,TestEmitLines,TestNormalizeBlankLines. (Go requires uppercase afterTest; plan names adjusted.) -
rule_test.gocontainsTestCountClassifierTokens. -
helpers_test.go(package rename) containsTestContentBlockLines. - All three
go testcommands are green. -
mdsmith check .is green.