(t *testing.T)
| 66 | } |
| 67 | |
| 68 | func TestGetCommandName(t *testing.T) { |
| 69 | rootCmd, childCmd, grandchildCmd := setupCobraCommands() |
| 70 | |
| 71 | t.Parallel() |
| 72 | |
| 73 | for _, tc := range []struct { |
| 74 | testName string |
| 75 | cmd *cobra.Command |
| 76 | expected string |
| 77 | }{ |
| 78 | { |
| 79 | testName: "rootCmd", |
| 80 | cmd: rootCmd, |
| 81 | expected: "", |
| 82 | }, |
| 83 | { |
| 84 | testName: "childCmd", |
| 85 | cmd: childCmd, |
| 86 | expected: "child", |
| 87 | }, |
| 88 | { |
| 89 | testName: "grandchildCmd", |
| 90 | cmd: grandchildCmd, |
| 91 | expected: "child grandchild", |
| 92 | }, |
| 93 | } { |
| 94 | t.Run(tc.testName, func(t *testing.T) { |
| 95 | t.Parallel() |
| 96 | actual := getCommandName(tc.cmd) |
| 97 | assert.Equal(t, actual, tc.expected) |
| 98 | }) |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | func TestStdioAttributes(t *testing.T) { |
| 103 | outBuffer := new(bytes.Buffer) |
nothing calls this directly
no test coverage detected
searching dependent graphs…