TestWalkFields test the WalkFields
(t *testing.T)
| 34 | |
| 35 | // TestWalkFields test the WalkFields |
| 36 | func TestWalkFields(t *testing.T) { |
| 37 | fs := WalkFields(reflect.TypeOf(TestStructForWalkFields{}), func(field *reflect.StructField) bool { |
| 38 | return strings.Contains(strings.ToLower(field.Tag.Get("gorm")), "primarykey") |
| 39 | }) |
| 40 | |
| 41 | assert.Equal(t, fs[0].Name, "ID") |
| 42 | assert.Equal(t, fs[1].Name, "Time") |
| 43 | } |
nothing calls this directly
no test coverage detected