MCPcopy Index your code
hub / github.com/apache/devlake / TestWalkFields

Function TestWalkFields

backend/core/utils/structfield_test.go:36–43  ·  view source on GitHub ↗

TestWalkFields test the WalkFields

(t *testing.T)

Source from the content-addressed store, hash-verified

34
35// TestWalkFields test the WalkFields
36func 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}

Callers

nothing calls this directly

Calls 2

WalkFieldsFunction · 0.85
GetMethod · 0.65

Tested by

no test coverage detected