| id | 2606260615 |
|---|---|
| title | Add dedicated unit tests for unexported helpers in cue/cuelite/engine.go |
| status | ✅ |
| summary | Seven unexported helpers in cue/cuelite/engine.go lack dedicated unit tests. Adds TestCombineMode, TestMkBottom, TestTopValue, TestEngineValue_IsBottomV, TestEngineValue_DefaultValue, TestEngineValue_DescribeBound, and TestBound_Describe. |
| model | sonnet |
Seven unexported helpers in
cue/cuelite/engine.go lack dedicated
unit tests. Add a TestFoo for each one.
Closes the 2026-06-26 audit finding.
Audit 2026-06-26 (range: 3d35b77..fe7141b)
flagged seven unexported helpers. The file
was touched in the perf commit e7cb8b0
(fmt.Sprintf → strconv in describe).
Functions lacking dedicated tests:
combineMode(a, b defaultMode) defaultModemkBottom(path []string, format string, args ...any) *engineValuetopValue() *engineValue(v *engineValue) isBottomV() bool(v *engineValue) defaultValue() (*engineValue, bool)(v *engineValue) describeBound() string(b bound) describe() string
Several are used in existing coverage
tests (mkBottom, topValue, isBottomV)
but lack a TestFunctionName-style test.
The architecture tests doc §"every function
by name" requires one.
- Add
TestCombineModeincue/cuelite/engine_test.goor a newengine_helpers_test.go. Cover all fourcombineModetable entries. - Add
TestMkBottom. Confirm the returned value satisfiesisBottomV()and thatdescribe()includes the formatted message. - Add
TestTopValue. Confirmdescribe() == "_"andisBottomV() == false. - Add
TestEngineValue_IsBottomV. Covernilreceiver (false),kBottom(true), and a non-bottom value (false). - Add
TestEngineValue_DefaultValue. Cover a value with a default (returns default andtrue) and a value with no default (returnsfalse). - Add
TestEngineValue_DescribeBound. Cover a bounded integer (>=1 & <=10) and a string match constraint. - Add
TestBound_Describe. Cover each operator (>=,<=,>,<,!=,=~,!~) andstrings.MinRunes.
- Each of the seven functions has a dedicated top-level test.
-
go test ./cue/cuelite/...green. -
go vet ./...clean. - No production code changed; tests only.