| id | 2606071931 |
|---|---|
| title | Unit tests for include-rule private validation helpers |
| status | ✅ |
| summary | Add dedicated unit tests for the four private helpers extracted from validateIncludeDirective in plan 232/233. |
| model | haiku |
| depends-on |
Add a named Test<Function> for each of the four private
helpers extracted from validateIncludeDirective in plans
232 and 233.
Commits 09403b4 (plan 232) and 74c72dc (plan 233)
extracted four private helpers:
validateHeadingOffset— integer −6 to 6, conflicts withheading-level.validateHeadingLevel— numeric h1–h6 or named level.validateExtractParam— extract parameter validation.findParentHeadingLevel— AST walk for nearest heading.
Each commit added AST-transform tests only.
The validation wrappers have no direct unit test.
Integration and fixture tests cover them indirectly.
No Test<Function> symbol names them.
Severity: tax (private; covered indirectly, but no red/green entry point for future refactors).
- Add
TestValidateHeadingOffsetininternal/rules/include/headings_test.go:
- missing param, invalid integer, out-of-range, valid,
conflict with
heading-level.
- Add
TestValidateHeadingLevel:
- missing param, invalid string, valid numeric/named.
- Add
TestValidateExtractParamcovering its branches. - Add
TestFindParentHeadingLevel:
- no heading above marker; heading found at depth.
- Run
go test ./internal/rules/include/... -vand confirm the newTest*names appear.
-
TestValidateHeadingOffsetcovers five cases. -
TestValidateHeadingLevelcovers three cases. -
TestValidateExtractParamhas branch coverage. -
TestFindParentHeadingLevelcovers both cases. - All tests pass:
go test ./... -
go tool golangci-lint runreports no issues