(t *testing.T)
| 1542 | } |
| 1543 | |
| 1544 | func TestValidArgsFuncInBashScript(t *testing.T) { |
| 1545 | rootCmd := &Command{Use: "root", Args: NoArgs, Run: emptyRun} |
| 1546 | child := &Command{ |
| 1547 | Use: "child", |
| 1548 | ValidArgsFunction: validArgsFunc, |
| 1549 | Run: emptyRun, |
| 1550 | } |
| 1551 | rootCmd.AddCommand(child) |
| 1552 | |
| 1553 | buf := new(bytes.Buffer) |
| 1554 | assertNoErr(t, rootCmd.GenBashCompletion(buf)) |
| 1555 | output := buf.String() |
| 1556 | |
| 1557 | check(t, output, "has_completion_function=1") |
| 1558 | } |
| 1559 | |
| 1560 | func TestNoValidArgsFuncInBashScript(t *testing.T) { |
| 1561 | rootCmd := &Command{Use: "root", Args: NoArgs, Run: emptyRun} |
nothing calls this directly
no test coverage detected