Skip to content

test: cover the v0.3.0 changes - #3

Merged
boeboe merged 1 commit into
mainfrom
test-coverage-v0.3.0
Nov 7, 2026
Merged

boeboe merged 1 commit into
mainfrom
test-coverage-v0.3.0

Conversation

@boeboe

@boeboe boeboe commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Tests only: covers the lines that #2 added or changed in internal/goapi/goapi.go, internal/check/code.go and internal/check/api.go. Codecov flagged 27 lines there as uncovered.

  • internal/goapi/goapi_test.go (new): covers how Load records dependency imports (a /vN suffix, an alias, blank and dot imports, the standard library, the module's own packages, deduplication) and test functions (external _test packages, methods, lowercase after the prefix, a _test.go file that does not parse). Also covers Index.IsTest and ExportedNames (skips _test.go files and files that do not parse; a missing directory).
  • internal/check/unit_test.go: table tests for bestPackage, hasAny, isInternal and stripSpans.

Changed-line coverage (go cover, every package's tests together): goapi.go 51/62 -> 62/62, code.go 36/44 -> 44/44, api.go 61/63 -> 63/63.

The tests found two behaviours that look wrong. This PR does not change them:

  • internal/goapi/goapi.go:229 addTests parses without parser.ParseComments. ignored(f) therefore never sees a //go:build ignore line, and the test functions and imports of such a file are still recorded.
  • internal/goapi/goapi.go:550 The ExportedNames doc comment says it returns struct fields, but only funcs, values, types and methods are added.

🤖 Generated with Claude Code

Add goapi tests for Load's recording of dependency imports (version
suffix, alias, blank and dot imports, dedup) and test functions
(external test packages, receivers, unparsable files), Index.IsTest and
ExportedNames. Add check unit tests for bestPackage, hasAny, isInternal
and stripSpans.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@boeboe
boeboe merged commit b30482f into main Nov 7, 2026
13 checks passed
@boeboe
boeboe deleted the test-coverage-v0.3.0 branch November 7, 2026 11:16
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