(t *testing.T)
| 159 | func (e *argError) ArgName() string { return e.name } |
| 160 | |
| 161 | func TestChkRunError(t *testing.T) { |
| 162 | testCases := map[string]struct { |
| 163 | err error |
| 164 | exp error |
| 165 | }{ |
| 166 | "Param error": {&argError{"flag"}, errors.New("pflag: help requested")}, |
| 167 | "401": {&unauthedError{}, errors.New("The API token was declined. Please correct it or do not send a token to use the free plan.")}, |
| 168 | "Generic error": {errors.New("meep"), errors.New("meep")}, |
| 169 | "No error": {nil, nil}, |
| 170 | } |
| 171 | for name, tc := range testCases { |
| 172 | t.Run(name, func(t *testing.T) { |
| 173 | if got, exp := chkRunError(tc.err), tc.exp; !cmpError(got, exp) { |
| 174 | t.Fatalf("expected %v; got %v", exp, got) |
| 175 | } |
| 176 | }) |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | func TestInvalidArgHelp(t *testing.T) { |
| 181 | var fo string |
nothing calls this directly
no test coverage detected