MCPcopy Index your code
hub / github.com/cli/cli / TestValidAliasExpansionFunc

Function TestValidAliasExpansionFunc

pkg/cmd/alias/shared/validations_test.go:34–54  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

32}
33
34func TestValidAliasExpansionFunc(t *testing.T) {
35 // Create fake command structure for testing.
36 issueCmd := &cobra.Command{Use: "issue"}
37 prCmd := &cobra.Command{Use: "pr"}
38 prCmd.AddCommand(&cobra.Command{Use: "checkout"})
39
40 cmd := &cobra.Command{}
41 cmd.AddCommand(prCmd)
42 cmd.AddCommand(issueCmd)
43
44 f := ValidAliasExpansionFunc(cmd)
45
46 assert.False(t, f("ps"))
47 assert.False(t, f("checkout"))
48 assert.False(t, f("repo list"))
49
50 assert.True(t, f("!git branch --show-current"))
51 assert.True(t, f("pr"))
52 assert.True(t, f("pr checkout"))
53 assert.True(t, f("issue"))
54}

Callers

nothing calls this directly

Calls 1

ValidAliasExpansionFuncFunction · 0.85

Tested by

no test coverage detected