(t *testing.T)
| 107 | } |
| 108 | |
| 109 | func TestErrorExprValidate(t *testing.T) { |
| 110 | cases := []struct { |
| 111 | Name string |
| 112 | DSL func() |
| 113 | Error string |
| 114 | }{ |
| 115 | {"no error", testdata.ValidErrorsDSL, ""}, |
| 116 | {"invalid-struct-error-name-meta", testdata.InvalidStructErrorNameDSL, |
| 117 | `attribute: error name "a" must be required in type "ServiceError" |
| 118 | attribute: duplicate error names in type "Error" |
| 119 | attribute: error name "a" must be a string in type "Error" |
| 120 | attribute: error name "a" must be required in type "Error" |
| 121 | attribute: type "ErrorType" is used to define multiple errors and must identify the attribute containing the error name with ErrorName |
| 122 | attribute: type "ErrorType" is used to define multiple errors and must identify the attribute containing the error name with ErrorName`, |
| 123 | }, |
| 124 | } |
| 125 | for _, tc := range cases { |
| 126 | t.Run(tc.Name, func(t *testing.T) { |
| 127 | if tc.Error == "" { |
| 128 | expr.RunDSL(t, tc.DSL) |
| 129 | } else { |
| 130 | err := expr.RunInvalidDSL(t, tc.DSL) |
| 131 | assert.EqualError(t, err, tc.Error) |
| 132 | } |
| 133 | }) |
| 134 | } |
| 135 | } |
nothing calls this directly
no test coverage detected