Repository navigation
test: cover the v0.3.0 changes - #3
Merged
Merged
Conversation
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 Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tests only: covers the lines that #2 added or changed in
internal/goapi/goapi.go,internal/check/code.goandinternal/check/api.go. Codecov flagged 27 lines there as uncovered.internal/goapi/goapi_test.go(new): covers howLoadrecords dependency imports (a/vNsuffix, an alias, blank and dot imports, the standard library, the module's own packages, deduplication) and test functions (external_testpackages, methods, lowercase after the prefix, a_test.gofile that does not parse). Also coversIndex.IsTestandExportedNames(skips_test.gofiles and files that do not parse; a missing directory).internal/check/unit_test.go: table tests forbestPackage,hasAny,isInternalandstripSpans.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:229addTestsparses withoutparser.ParseComments.ignored(f)therefore never sees a//go:build ignoreline, and the test functions and imports of such a file are still recorded.internal/goapi/goapi.go:550TheExportedNamesdoc comment says it returns struct fields, but only funcs, values, types and methods are added.🤖 Generated with Claude Code