(t *testing.T)
| 10177 | } |
| 10178 | |
| 10179 | func TestMultipleRecursiveExtractStructCache(t *testing.T) { |
| 10180 | validate := New() |
| 10181 | |
| 10182 | type Recursive struct { |
| 10183 | Field *string `validate:"required,len=5,ne=string"` |
| 10184 | } |
| 10185 | |
| 10186 | var test Recursive |
| 10187 | |
| 10188 | current := reflect.ValueOf(test) |
| 10189 | name := "Recursive" |
| 10190 | proceed := make(chan struct{}) |
| 10191 | |
| 10192 | sc := validate.extractStructCache(current, name) |
| 10193 | ptr := fmt.Sprintf("%p", sc) |
| 10194 | |
| 10195 | for i := 0; i < 100; i++ { |
| 10196 | go func() { |
| 10197 | <-proceed |
| 10198 | sc := validate.extractStructCache(current, name) |
| 10199 | Equal(t, ptr, fmt.Sprintf("%p", sc)) |
| 10200 | }() |
| 10201 | } |
| 10202 | |
| 10203 | close(proceed) |
| 10204 | } |
| 10205 | |
| 10206 | // Thanks @robbrockbank, see https://github.com/go-playground/validator/issues/249 |
| 10207 | func TestPointerAndOmitEmpty(t *testing.T) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…