-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test(client): wrap cmd.SetArgs to fix bugs for cmd.SetArgs #18960
Conversation
WalkthroughThe overall change introduces a new utility function, Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
@julienrbrt Hi sir, could you please help me review this pr😀 |
Would it be possible to add
Lmk what you think |
SGTM |
@facundomedica Suggestion addressed. |
Perfect, although I meant to say that ResetArgs should only do the resetting/clearing. We shouldn't be passing args to it other than the cmd |
It makes sense, I will remove the args param |
@facundomedica Hi sir, suggestion addressed😀 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some changes required but lgtm
import "strings" | ||
|
||
type MockFlagsWithComma struct { | ||
Ary []string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ary []string | |
Arg []string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or Args
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually it means 'Array', not 'arg' or 'args', just for illustrate slice type field
Co-authored-by: Facundo Medica <14063057+facundomedica@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tiny nits. Otherwise code lgtm
Co-authored-by: Likhita Polavarapu <78951027+likhita-809@users.noreply.github.com>
Co-authored-by: Likhita Polavarapu <78951027+likhita-809@users.noreply.github.com>
Co-authored-by: Likhita Polavarapu <78951027+likhita-809@users.noreply.github.com>
Refer to:
Since
spf13/pflag
looks like unmaintained for a long time(above 3 years), it's hard to get support from them for adding newReset() error
function topflag.Value
interface. I made some improvements totestutil.SetArgs
to support more test cases.Now, the new implementation of
testutil.SetArgs
supports all built-in implementations ofpflag.Value
andpflag.SliceValue
.Note:
testutil.SetArgs
is only compatible with the following flag types:cc @julienrbrt