test: add shell-completion case for hidden BoolWithInverseFlag - #2408
Merged
Conversation
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.
What type of PR is this?
(REQUIRED)
What this PR does / why we need it:
(REQUIRED)
Follow-up from review of #2388.
PR #2388 changed
printFlagSuggestionsinhelp.goto skip flags via theVisibleFlag/IsVisible()interface instead of the previousflag.(*BoolFlag)assertion. The previous check only skipped hidden bool flags, and because the*BoolFlagassertion does not match the*BoolWithInverseFlagconcrete type, hiddenBoolWithInverseFlags were also leaked into shell completion suggestions.That leak is now fixed by the interface-based check, but the regression test table in
TestDefaultCompleteWithFlagsonly covered theBoolFlag(hidden-bool) andStringFlag(new in #2388) cases.This PR adds a
BoolWithInverseFlagcase to theTestDefaultCompleteWithFlagstable — a hidden--excellentBoolWithInverseFlagalongside a visible--excitementone — to lock in the fix for this type too.Which issue(s) this PR fixes:
(REQUIRED)
Fixes #2405
Special notes for your reviewer:
Verified the new test catches the regression: with the old
*BoolFlag-only assertion restored inhelp.go, the case fails with the hidden--excellentleaking into the suggestions (--excellent\n--excitement\n). With the current interface-based check it passes.Testing
Ran the focused test batch:
All cases pass, including the new
typical-flag-suggestion-hidden-bool-with-inverse.make lintandgo vet ./...are clean.Release Notes
(REQUIRED)