Skip to content

Add comprehensive lib package tests to drive coverage toward 100%#305

Draft
Codex wants to merge 2 commits intomasterfrom
codex/add-unit-tests-lib-package
Draft

Add comprehensive lib package tests to drive coverage toward 100%#305
Codex wants to merge 2 commits intomasterfrom
codex/add-unit-tests-lib-package

Conversation

@Codex
Copy link
Copy Markdown

@Codex Codex AI commented Mar 6, 2026

The lib package lacked unit tests, preventing confident changes and high coverage.

  • Test scaffolding: Added shared helpers and mock converters to validate behaviors without external deps (lib/helpers_test.go).
  • Core helpers: Covered URL fetchers, ignore options, and wanted-list JSON parsing (common_test.go, lib_test.go).
  • Config parsing: Exercised config creator registration and converter unmarshalling for input/output paths, including hujson handling (config_test.go, converter_test.go, instance_test.go).
  • Container semantics: Verified add/merge/remove branches, lookup filters, builder creation, and error paths across IPv4/IPv6 permutations (container_test.go).
  • Entry semantics: Tested prefix processing for multiple input types, builder error propagation, marshal methods with ignore options, and edge/invalid cases (entry_test.go).

Example:

c := NewContainer()
e := NewEntry("ZONEA")
_ = e.AddPrefix("10.3.0.0/16")
_ = c.Add(e)
names, ok, _ := c.Lookup("10.3.5.1")
fmt.Println(names, ok) // [ZONEA] true

@Codex Codex AI changed the title [WIP] Add comprehensive unit tests for lib package Add comprehensive lib package tests to drive coverage toward 100% Mar 6, 2026
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.

2 participants