(t *testing.T)
| 252 | } |
| 253 | |
| 254 | func TestBoolWithInverseWithPrefix(t *testing.T) { |
| 255 | flagMethod := func() *BoolWithInverseFlag { |
| 256 | return &BoolWithInverseFlag{ |
| 257 | Name: "env", |
| 258 | InversePrefix: "without-", |
| 259 | } |
| 260 | } |
| 261 | |
| 262 | testCases := []*boolWithInverseTestCase{ |
| 263 | { |
| 264 | args: []string{"--without-env"}, |
| 265 | toBeSet: true, |
| 266 | value: false, |
| 267 | }, |
| 268 | { |
| 269 | args: []string{"--env"}, |
| 270 | toBeSet: true, |
| 271 | value: true, |
| 272 | }, |
| 273 | { |
| 274 | toBeSet: false, |
| 275 | value: false, |
| 276 | }, |
| 277 | { |
| 278 | args: []string{"--env", "--without-env"}, |
| 279 | err: fmt.Errorf("cannot set both flags `--env` and `--without-env`"), |
| 280 | }, |
| 281 | { |
| 282 | args: []string{"--without-env", "--env"}, |
| 283 | err: fmt.Errorf("cannot set both flags `--env` and `--without-env`"), |
| 284 | }, |
| 285 | } |
| 286 | |
| 287 | err := runBoolWithInverseFlagTests(t, flagMethod, testCases) |
| 288 | if err != nil { |
| 289 | t.Error(err) |
| 290 | return |
| 291 | } |
| 292 | } |
| 293 | |
| 294 | func TestBoolWithInverseRequired(t *testing.T) { |
| 295 | flagMethod := func() *BoolWithInverseFlag { |
nothing calls this directly
no test coverage detected