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

Function TestBoolWithInverseBasic

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

Source from the content-addressed store, hash-verified

71}
72
73func TestBoolWithInverseBasic(t *testing.T) {
74 flagMethod := func() *BoolWithInverseFlag {
75 return &BoolWithInverseFlag{
76 Name: "env",
77 }
78 }
79
80 testCases := []*boolWithInverseTestCase{
81 {
82 args: []string{"--no-env"},
83 toBeSet: true,
84 value: false,
85 },
86 {
87 args: []string{"--env"},
88 toBeSet: true,
89 value: true,
90 },
91 {
92 toBeSet: false,
93 value: false,
94 },
95 {
96 args: []string{"--env", "--no-env"},
97 err: errBothEnvFlagsAreSet,
98 },
99 }
100
101 err := runBoolWithInverseFlagTests(t, flagMethod, testCases)
102 if err != nil {
103 t.Error(err)
104 return
105 }
106}
107
108func TestBoolWithInverseAction(t *testing.T) {
109 err := fmt.Errorf("action called")

Callers

nothing calls this directly

Calls 2

ErrorMethod · 0.45

Tested by

no test coverage detected