(t *testing.T)
| 25 | ) |
| 26 | |
| 27 | func TestArgs(t *testing.T) { |
| 28 | runTestCases(t, []testCase{{ |
| 29 | validateFunc: NoArgs, |
| 30 | }, { |
| 31 | args: []string{"one"}, |
| 32 | validateFunc: NoArgs, |
| 33 | wantError: `"root" accepts no arguments`, |
| 34 | }, { |
| 35 | args: []string{"one"}, |
| 36 | validateFunc: ExactArgs(1), |
| 37 | }, { |
| 38 | validateFunc: ExactArgs(1), |
| 39 | wantError: `"root" requires 1 argument`, |
| 40 | }, { |
| 41 | validateFunc: ExactArgs(2), |
| 42 | wantError: `"root" requires 2 arguments`, |
| 43 | }, { |
| 44 | args: []string{"one"}, |
| 45 | validateFunc: MaximumNArgs(1), |
| 46 | }, { |
| 47 | args: []string{"one", "two"}, |
| 48 | validateFunc: MaximumNArgs(1), |
| 49 | wantError: `"root" accepts at most 1 argument`, |
| 50 | }, { |
| 51 | validateFunc: MinimumNArgs(1), |
| 52 | wantError: `"root" requires at least 1 argument`, |
| 53 | }, { |
| 54 | args: []string{"one", "two"}, |
| 55 | validateFunc: MinimumNArgs(1), |
| 56 | }}) |
| 57 | } |
| 58 | |
| 59 | type testCase struct { |
| 60 | args []string |
nothing calls this directly
no test coverage detected
searching dependent graphs…