| 41 | } |
| 42 | |
| 43 | func Test_ConstraintAnalyze_MissingArgs(t *testing.T) { |
| 44 | t.Parallel() |
| 45 | |
| 46 | testCases := []struct { |
| 47 | handler ConstraintAnalyzer |
| 48 | name string |
| 49 | }{ |
| 50 | {datetimeConstraintType{}, "datetime"}, |
| 51 | {minLenConstraintType{}, "minLen"}, |
| 52 | {maxLenConstraintType{}, "maxLen"}, |
| 53 | {lenConstraintType{}, "len"}, |
| 54 | {minConstraintType{}, "min"}, |
| 55 | {maxConstraintType{}, "max"}, |
| 56 | {regexConstraintType{}, "regex"}, |
| 57 | } |
| 58 | |
| 59 | for _, tc := range testCases { |
| 60 | t.Run(tc.name, func(t *testing.T) { |
| 61 | t.Parallel() |
| 62 | _, err := tc.handler.Analyze([]string{}) |
| 63 | require.Error(t, err) |
| 64 | }) |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | func Test_ConstraintAnalyze_BetweenLen(t *testing.T) { |
| 69 | t.Parallel() |