(t *testing.T)
| 108 | } |
| 109 | |
| 110 | func TestExactArgs(t *testing.T) { |
| 111 | testCases := []testCase{ |
| 112 | { |
| 113 | validateFunc: ExactArgs(0), |
| 114 | expectedError: "no error", |
| 115 | }, |
| 116 | { |
| 117 | validateFunc: ExactArgs(1), |
| 118 | expectedError: "1 argument", |
| 119 | }, |
| 120 | { |
| 121 | validateFunc: ExactArgs(2), |
| 122 | expectedError: "2 arguments", |
| 123 | }, |
| 124 | } |
| 125 | for _, tc := range testCases { |
| 126 | cmd := newDummyCommand(tc.validateFunc) |
| 127 | cmd.SetArgs(tc.args) |
| 128 | assert.ErrorContains(t, cmd.Execute(), tc.expectedError) |
| 129 | } |
| 130 | } |
| 131 | |
| 132 | type testCase struct { |
| 133 | args []string |
nothing calls this directly
no test coverage detected
searching dependent graphs…