MCPcopy Index your code
hub / github.com/docker/cli / TestGetFullCommandName

Function TestGetFullCommandName

cli/command/telemetry_utils_test.go:34–66  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

32}
33
34func TestGetFullCommandName(t *testing.T) {
35 rootCmd, childCmd, grandchildCmd := setupCobraCommands()
36
37 t.Parallel()
38
39 for _, tc := range []struct {
40 testName string
41 cmd *cobra.Command
42 expected string
43 }{
44 {
45 testName: "rootCmd",
46 cmd: rootCmd,
47 expected: "root",
48 },
49 {
50 testName: "childCmd",
51 cmd: childCmd,
52 expected: "root child",
53 },
54 {
55 testName: "grandChild",
56 cmd: grandchildCmd,
57 expected: "root child grandchild",
58 },
59 } {
60 t.Run(tc.testName, func(t *testing.T) {
61 t.Parallel()
62 actual := getFullCommandName(tc.cmd)
63 assert.Equal(t, actual, tc.expected)
64 })
65 }
66}
67
68func TestGetCommandName(t *testing.T) {
69 rootCmd, childCmd, grandchildCmd := setupCobraCommands()

Callers

nothing calls this directly

Calls 2

setupCobraCommandsFunction · 0.85
getFullCommandNameFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…