(t *testing.T, err error, nsKey, structNsKey, field, structField, expectedTag string)
| 116 | } |
| 117 | |
| 118 | func AssertError(t *testing.T, err error, nsKey, structNsKey, field, structField, expectedTag string) { |
| 119 | errs := err.(ValidationErrors) |
| 120 | |
| 121 | found := false |
| 122 | var fe FieldError |
| 123 | |
| 124 | for i := 0; i < len(errs); i++ { |
| 125 | if errs[i].Namespace() == nsKey && errs[i].StructNamespace() == structNsKey { |
| 126 | found = true |
| 127 | fe = errs[i] |
| 128 | break |
| 129 | } |
| 130 | } |
| 131 | |
| 132 | EqualSkip(t, 2, found, true) |
| 133 | NotEqualSkip(t, 2, fe, nil) |
| 134 | EqualSkip(t, 2, fe.Field(), field) |
| 135 | EqualSkip(t, 2, fe.StructField(), structField) |
| 136 | EqualSkip(t, 2, fe.Tag(), expectedTag) |
| 137 | } |
| 138 | |
| 139 | func AssertDeepError(t *testing.T, err error, nsKey, structNsKey, field, structField, expectedTag, actualTag string) { |
| 140 | errs := err.(ValidationErrors) |
no test coverage detected
searching dependent graphs…