(t *testing.T)
| 8 | ) |
| 9 | |
| 10 | func TestValidAliasNameFunc(t *testing.T) { |
| 11 | // Create fake command structure for testing. |
| 12 | issueCmd := &cobra.Command{Use: "issue"} |
| 13 | prCmd := &cobra.Command{Use: "pr"} |
| 14 | prCmd.AddCommand(&cobra.Command{Use: "checkout"}) |
| 15 | |
| 16 | cmd := &cobra.Command{} |
| 17 | cmd.AddCommand(prCmd) |
| 18 | cmd.AddCommand(issueCmd) |
| 19 | |
| 20 | f := ValidAliasNameFunc(cmd) |
| 21 | |
| 22 | assert.False(t, f("pr")) |
| 23 | assert.False(t, f("pr checkout")) |
| 24 | assert.False(t, f("issue")) |
| 25 | assert.False(t, f("repo list")) |
| 26 | |
| 27 | assert.True(t, f("ps")) |
| 28 | assert.True(t, f("checkout")) |
| 29 | assert.True(t, f("issue erase")) |
| 30 | assert.True(t, f("pr erase")) |
| 31 | assert.True(t, f("pr checkout branch")) |
| 32 | } |
| 33 | |
| 34 | func TestValidAliasExpansionFunc(t *testing.T) { |
| 35 | // Create fake command structure for testing. |
nothing calls this directly
no test coverage detected