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

Function runBoolWithInverseFlagTests

flag_bool_with_inverse_test.go:48–71  ·  view source on GitHub ↗
(t *testing.T, newFlagMethod func() *BoolWithInverseFlag, cases []*boolWithInverseTestCase)

Source from the content-addressed store, hash-verified

46}
47
48func runBoolWithInverseFlagTests(t *testing.T, newFlagMethod func() *BoolWithInverseFlag, cases []*boolWithInverseTestCase) error {
49 for _, tc := range cases {
50 t.Run(strings.Join(tc.args, " ")+fmt.Sprintf("%[1]v %[2]v %[3]v", tc.value, tc.toBeSet, tc.err), func(t *testing.T) {
51 r := require.New(t)
52
53 fl := newFlagMethod()
54
55 err := tc.Run(t, fl)
56 if err != nil && tc.err == nil {
57 r.NoError(err)
58 }
59
60 if err == nil && tc.err != nil {
61 r.Error(err)
62 }
63
64 if err != nil && tc.err != nil {
65 r.ErrorContains(err, tc.err.Error())
66 }
67 })
68 }
69
70 return nil
71}
72
73func TestBoolWithInverseBasic(t *testing.T) {
74 flagMethod := func() *BoolWithInverseFlag {

Callers 6

TestBoolWithInverseBasicFunction · 0.85
TestBoolWithInverseAliasFunction · 0.85

Calls 2

RunMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected