Skip to content

Commit e6ae094

Browse files
committed
add test
1 parent adf2898 commit e6ae094

3 files changed

+16
-2
lines changed

internal/core/cobra_utils_test.go

+11-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func testGetCommands() *Commands {
4444
AllowAnonymousClient: true,
4545
ArgsType: reflect.TypeOf(testType{}),
4646
Run: func(ctx context.Context, argsI interface{}) (i interface{}, e error) {
47-
return "", nil
47+
return argsI, nil
4848
},
4949
},
5050
&Command{
@@ -198,7 +198,16 @@ func Test_PositionalArg(t *testing.T) {
198198

199199
t.Run("multi positional", Test(&TestConfig{
200200
Commands: testGetCommands(),
201-
Cmd: "scw test positional test1 test2",
201+
Cmd: "scw test positional tag=tag01 test1 test2",
202+
Check: TestCheckCombine(
203+
TestCheckExitCode(0),
204+
TestCheckGolden(),
205+
),
206+
}))
207+
208+
t.Run("multi positional json", Test(&TestConfig{
209+
Commands: testGetCommands(),
210+
Cmd: "scw test positional -o json tag=tag01 test1 test2",
202211
Check: TestCheckCombine(
203212
TestCheckExitCode(0),
204213
TestCheckGolden(),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[{"NameID":"test1","Tag":"tag01"},{"NameID":"test2","Tag":"tag01"}]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
name-id test1
2+
tag tag01
3+
name-id test2
4+
tag tag01

0 commit comments

Comments
 (0)