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

Function TestBoolWithInverseAlias

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

Source from the content-addressed store, hash-verified

152}
153
154func TestBoolWithInverseAlias(t *testing.T) {
155 flagMethod := func() *BoolWithInverseFlag {
156 return &BoolWithInverseFlag{
157 Name: "env",
158 Aliases: []string{"e", "do-env"},
159 }
160 }
161
162 testCases := []*boolWithInverseTestCase{
163 {
164 args: []string{"--no-e"},
165 toBeSet: true,
166 value: false,
167 },
168 {
169 args: []string{"--e"},
170 toBeSet: true,
171 value: true,
172 },
173 {
174 toBeSet: false,
175 value: false,
176 },
177 {
178 args: []string{"--do-env", "--no-do-env"},
179 err: errBothEnvFlagsAreSet,
180 },
181 }
182
183 err := runBoolWithInverseFlagTests(t, flagMethod, testCases)
184 if err != nil {
185 t.Error(err)
186 return
187 }
188}
189
190func TestBoolWithInverseEnvVars(t *testing.T) {
191 flagMethod := func() *BoolWithInverseFlag {

Callers

nothing calls this directly

Calls 2

ErrorMethod · 0.45

Tested by

no test coverage detected