mirror of
https://github.com/ahmetb/kubectx.git
synced 2025-06-02 12:26:00 +00:00
feat: added test
This commit is contained in:
parent
9717232900
commit
8857602f83
@ -45,7 +45,7 @@ func parseArgs(argv []string) Op {
|
||||
if len(argv) > 1 {
|
||||
return InteractiveSwitchOp{SelfCmd: os.Args[0], Query: argv[1]}
|
||||
} else {
|
||||
return UnsupportedOp{Err: fmt.Errorf("'-q' needs arguments")}
|
||||
return UnsupportedOp{Err: fmt.Errorf("'-q' needs an argument")}
|
||||
}
|
||||
} else {
|
||||
return UnsupportedOp{Err: fmt.Errorf("'-q' only works in interactive mode")}
|
||||
|
@ -78,6 +78,10 @@ func Test_parseArgs_new(t *testing.T) {
|
||||
{name: "too many args",
|
||||
args: []string{"a", "b", "c"},
|
||||
want: UnsupportedOp{Err: fmt.Errorf("too many arguments")}},
|
||||
{name: "missing query",
|
||||
args: []string{"-q"},
|
||||
want: UnsupportedOp{Err: fmt.Errorf("'-q' only works in interactive mode")},
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
|
Loading…
Reference in New Issue
Block a user