This test make sure we keep backwards-compatibility with respect to the legacyArgs() function. It makes sure a sub-command accepts arguments and further sub-commands
(t *testing.T)
| 528 | // to the legacyArgs() function. |
| 529 | // It makes sure a sub-command accepts arguments and further sub-commands |
| 530 | func TestLegacyArgsSubcmdAcceptsArgs(t *testing.T) { |
| 531 | rootCmd := &Command{Use: "root", Args: nil, Run: emptyRun} |
| 532 | childCmd := &Command{Use: "child", Args: nil, Run: emptyRun} |
| 533 | grandchildCmd := &Command{Use: "grandchild", Args: nil, Run: emptyRun} |
| 534 | rootCmd.AddCommand(childCmd) |
| 535 | childCmd.AddCommand(grandchildCmd) |
| 536 | |
| 537 | _, err := executeCommand(rootCmd, "child", "somearg") |
| 538 | if err != nil { |
| 539 | t.Fatalf("Unexpected error: %v", err) |
| 540 | } |
| 541 | } |
nothing calls this directly
no test coverage detected