MCPcopy
hub / github.com/urfave/cli / TestCommand_Walk_Hidden

Function TestCommand_Walk_Hidden

command_test.go:6430–6447  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

6428}
6429
6430func TestCommand_Walk_Hidden(t *testing.T) {
6431 subCmd := &Command{Name: "bar", HideHelp: true}
6432 subSubCmd := &Command{Name: "baz"}
6433 subCmd.Commands = []*Command{subSubCmd}
6434
6435 cmd := &Command{
6436 Name: "foo",
6437 Commands: []*Command{subCmd},
6438 }
6439
6440 var visited []string
6441 err := cmd.Walk(func(c *Command) error {
6442 visited = append(visited, c.Name)
6443 return nil
6444 })
6445 require.NoError(t, err)
6446 assert.Equal(t, []string{"foo", "bar", "baz"}, visited)
6447}
6448
6449func TestCommand_Walk_NilFn(t *testing.T) {
6450 cmd := &Command{Name: "foo"}

Callers

nothing calls this directly

Calls 1

WalkMethod · 0.95

Tested by

no test coverage detected