| id | 2606260211 |
|---|---|
| title | Add dedicated unit tests for layer0_html.go helpers |
| status | ✅ |
| summary | Seven unexported helpers in internal/lint/layer0_html.go lack dedicated unit tests. The 2026-06-26 audit caught them when the perf commit touched the file. |
| model | sonnet |
The 2026-06-26 audit (range: 3d35b77..fe7141b)
found internal/lint/layer0_html.go in the
touched set via the map→struct perf commit.
Seven unexported helpers lack dedicated unit
tests. Tests doc §"every function by name"
requires TestFunctionName for each.
layer0_html_test.go currently only tests
tagInAllowedSet (two test functions).
Add dedicated unit tests for the seven
unexported helpers in
internal/lint/layer0_html.go that lack
TestFunctionName-style coverage.
-
Add
TestOpenHTMLBlock. Check each opener type: type-1 raw tags, type-2 comment, type-3 PI, type-4 decl, type-5 CDATA, type-6 block tag, type-7 tag. Check thatinParagraph=trueblocks type-7. Check non-HTML lines returnhtmlNone. -
Add
TestTagName_LowerInto— lower-cases ASCII upper, preserves lowercase, truncates at 32 bytes, returns the correct slice. -
Add
TestType7TagIsRawText— returns true for script/style/pre/textarea (any case), false for div and span. -
Add
TestType7TagBytes— extracts the tag name bytes from a type-7 line, handles closing-tag slash, handles leading spaces. -
Add
TestIsTagByte— true for letters, digits, hyphen; false for/,>,!. -
Add
TestHTMLBlockCloses. Type-1 closes on</script>(case-insensitive). Type-2 on-->, type-3 on?>, type-4 on>, type-5 on]]>. Types 6–7 return false (blank-line close handled by caller). -
Add
TestScanner_TryHTMLBlock— build a minimalscannerwithlinesset, calltryHTMLBlock; verify the span added and cursor advance for a comment block, a type-6 block, and a non-HTML line. Thescannertype andaddSpanare in the same package so the test file has access.
-
go test ./internal/lint/...green. -
go vet ./...green. - Each of the seven functions has a test named exactly per the Go binding in Tests doc §"Go-specific bindings".
- No new production code changed (tests only).
-
mdsmith check .passes (0 failures).