(t *testing.T)
| 32 | } |
| 33 | |
| 34 | func 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 | |
| 68 | func TestGetCommandName(t *testing.T) { |
| 69 | rootCmd, childCmd, grandchildCmd := setupCobraCommands() |
nothing calls this directly
no test coverage detected
searching dependent graphs…