MCPcopy
hub / github.com/urfave/cli / TestBoolWithInverseRequired

Function TestBoolWithInverseRequired

flag_bool_with_inverse_test.go:294–324  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

292}
293
294func TestBoolWithInverseRequired(t *testing.T) {
295 flagMethod := func() *BoolWithInverseFlag {
296 return &BoolWithInverseFlag{
297 Name: "env",
298 Required: true,
299 }
300 }
301
302 testCases := []*boolWithInverseTestCase{
303 {
304 args: []string{"--no-env"},
305 toBeSet: true,
306 value: false,
307 },
308 {
309 args: []string{"--env"},
310 toBeSet: true,
311 value: true,
312 },
313 {
314 args: []string{"--env", "--no-env"},
315 err: errBothEnvFlagsAreSet,
316 },
317 }
318
319 err := runBoolWithInverseFlagTests(t, flagMethod, testCases)
320 if err != nil {
321 t.Error(err)
322 return
323 }
324}
325
326func TestBoolWithInverseNames(t *testing.T) {
327 flag := &BoolWithInverseFlag{

Callers

nothing calls this directly

Calls 2

ErrorMethod · 0.45

Tested by

no test coverage detected