Skip to content

Commit

Permalink
Add test coverage for Command.VisibleCommands()
Browse files Browse the repository at this point in the history
  • Loading branch information
dearchap committed Oct 5, 2022
1 parent bea777e commit 1f03aa4
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -422,3 +422,30 @@ func TestCommand_CanAddVFlagOnCommands(t *testing.T) {
err := app.Run([]string{"foo", "bar"})
expect(t, err, nil)
}

func TestCommand_VisibleSubcCommands(t *testing.T) {

subc1 := &Command{
Name: "subc1",
Usage: "subc1 command1",
}
subc3 := &Command{
Name: "subc3",
Usage: "subc3 command2",
}
c := &Command{
Name: "bar",
Usage: "this is for testing",
Subcommands: []*Command{
subc1,
{
Name: "subc2",
Usage: "subc2 command2",
Hidden: true,
},
subc3,
},
}

expect(t, c.VisibleCommands(), []*Command{subc1, subc3})
}

0 comments on commit 1f03aa4

Please sign in to comment.