MCPcopy
hub / github.com/go-playground/validator / AssertDeepError

Function AssertDeepError

validator_test.go:139–157  ·  view source on GitHub ↗
(t *testing.T, err error, nsKey, structNsKey, field, structField, expectedTag, actualTag string)

Source from the content-addressed store, hash-verified

137}
138
139func AssertDeepError(t *testing.T, err error, nsKey, structNsKey, field, structField, expectedTag, actualTag string) {
140 errs := err.(ValidationErrors)
141
142 found := false
143 var fe FieldError
144
145 for i := 0; i < len(errs); i++ {
146 if errs[i].Namespace() == nsKey && errs[i].StructNamespace() == structNsKey && errs[i].Tag() == expectedTag && errs[i].ActualTag() == actualTag {
147 found = true
148 fe = errs[i]
149 break
150 }
151 }
152
153 EqualSkip(t, 2, found, true)
154 NotEqualSkip(t, 2, fe, nil)
155 EqualSkip(t, 2, fe.Field(), field)
156 EqualSkip(t, 2, fe.StructField(), structField)
157}
158
159func getError(err error, nsKey, structNsKey string) FieldError {
160 errs := err.(ValidationErrors)

Callers 3

TestKeysFunction · 0.85
TestKeysCustomValidationFunction · 0.85
TestKeyOrsFunction · 0.85

Calls 6

FieldMethod · 0.95
StructFieldMethod · 0.95
NamespaceMethod · 0.65
StructNamespaceMethod · 0.65
TagMethod · 0.65
ActualTagMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…