Repository navigation
[test-improver] Improve tests for util collections - #15792
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
π’ Approval recommended
No active review issues are identified, and the changes are limited to reorganizing and expanding focused utility tests without modifying production behavior.
No open issues π
What changed in this PR
This pull request improves the organization and edge-case coverage of utility collection tests without changing production behavior.
Changes:
- Converted
TestGetStringFromMapto a table-driven test with nil-value coverage. - Added
ShallowCloneMaptests for nil inputs, writable clones, and clone isolation. - Removed redundant
CopyTrimmedStringIntMapnil and empty-input coverage.
| File | Description |
|---|---|
internal/βutil/βcollections_test.go |
Reorganizes collection utility tests and adds focused edge-case assertions. |
Review effort: Lite (auto)
π mcpg Read-Only Stress β defaultSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: INCONCLUSIVE
No write of any kind succeeded or leaked through either surface. No security regression found; the gaps are purely test-coverage INCONCLUSIVE results, not FAIL.
|
File:
internal/util/collections_test.goChanges
TestGetStringFromMapto a table-driven test and added a nil-value case.ShallowCloneMapedge cases: nil input, writability of the clone, and that adding keys to the clone leaves the original unchanged.TestCopyTrimmedStringIntMap_NilAndEmptyReturnNil, which duplicated the table cases.Coverage: the
internal/utilpackage stays at 96.2% before and after. The uncovered lines are OS error paths inatomic_write.goand one line intruncate.go, so this change is about structure and assertion quality rather than coverage.Verification:
go vetandgofmtare clean, andgo test -count=3 ./internal/util/passes.