[Repo Assist] test(envvar): cover ExpandWithLookup nil-lookup fallback path - #4729
Merged
devantler merged 2 commits intoMay 14, 2026
Merged
Conversation
Add TestExpandWithLookup_NilLookupFallsBackToOsLookupEnv to verify that passing nil as the lookup function falls back to os.LookupEnv, covering the previously untested branch in ExpandWithLookup. Coverage for the package improves from 91.3% to 95.7%. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
Author
✅MegaLinter analysis: Success✅ Linters with no issuesactionlint, git_diff, hadolint, jscpd, jsonlint, lychee, markdown-table-formatter, markdownlint, prettier, prettier, stylelint, syft, trivy-sbom, trufflehog, v8r, v8r, yamllint See detailed reports in MegaLinter artifacts
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
devantler
added this pull request to the merge queue
May 14, 2026
devantler
deleted the
repo-assist/test-envvar-nil-lookup-coverage-1c2c49cc62228d88
branch
May 14, 2026 09:08
5 tasks
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.

🤖 This PR was created by Repo Assist, an automated AI assistant.
Add a test that covers the
nillookup branch inExpandWithLookup, verifying that passingnilas the lookup function falls back toos.LookupEnv.What has changed and why?
The
ExpandWithLookupfunction has a defensive guard that replaces anillookup withos.LookupEnv. This branch was previously uncovered, leaving the package at 91.3% statement coverage. The new test exercises that path, improving coverage to 95.7%.The remaining untested branch (
len(groups) < minGroupsForVarNameinexpandMatch) is a defensive guard that cannot be triggered through the public API because the regex always produces the required number of groups on a match.Type of change
Test Status
✅
go test -count=1 -cover ./pkg/envvar/...passes: 95.7% coverage (up from 91.3%)