Skip to content

Add unit tests for util package helpers#2285

Open
Jtekkk wants to merge 1 commit into
BishopFox:masterfrom
Jtekkk:claude/repo-improvements-4xcpnk
Open

Add unit tests for util package helpers#2285
Jtekkk wants to merge 1 commit into
BishopFox:masterfrom
Jtekkk:claude/repo-improvements-4xcpnk

Conversation

@Jtekkk

@Jtekkk Jtekkk commented Jul 10, 2026

Copy link
Copy Markdown

The util package's generic helpers were largely untested (~5% statement coverage). This adds table-driven and round-trip tests covering:

  • generics.go: Contains, Keys
  • resource_ids.go: RemoveElement (including input-immutability)
  • files.go: ByteCountBinary, DeflateBuf (deflate round-trip), CopyFile, ReadFileFromTarGz, ChmodR
  • cryptography.go: secure RNG (Intn, Int63n, Shuffle, Float64) range, distribution and panic behavior; PreludeEncrypt/PreludeDecrypt and RC4EncryptUnsafe round-trips
  • leaky: LeakyBuf Get/Put pooling, overflow, and wrong-size panic

Raises util coverage to ~90% and util/leaky to 100%. No production code changes.

Claude-Session: https://claude.ai/code/session_011UEBr6PgAvPt2hp6yzBXEk

Card

Details

The util package's generic helpers were largely untested (~5% statement
coverage). This adds table-driven and round-trip tests covering:

- generics.go: Contains, Keys
- resource_ids.go: RemoveElement (including input-immutability)
- files.go: ByteCountBinary, DeflateBuf (deflate round-trip), CopyFile,
  ReadFileFromTarGz, ChmodR
- cryptography.go: secure RNG (Intn, Int63n, Shuffle, Float64) range,
  distribution and panic behavior; PreludeEncrypt/PreludeDecrypt and
  RC4EncryptUnsafe round-trips
- leaky: LeakyBuf Get/Put pooling, overflow, and wrong-size panic

Raises util coverage to ~90% and util/leaky to 100%. No production code
changes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011UEBr6PgAvPt2hp6yzBXEk
@Jtekkk
Jtekkk requested a review from a team as a code owner July 10, 2026 01:42
@Jtekkk
Jtekkk requested a review from abdelobf July 10, 2026 01:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant