(t *testing.T, newFlagMethod func() *BoolWithInverseFlag, cases []*boolWithInverseTestCase)
| 46 | } |
| 47 | |
| 48 | func 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 | |
| 73 | func TestBoolWithInverseBasic(t *testing.T) { |
| 74 | flagMethod := func() *BoolWithInverseFlag { |
no test coverage detected