MCPcopy Index your code
hub / github.com/devfeel/mapper / Test_Object_AutoMapper_StructToMap

Function Test_Object_AutoMapper_StructToMap

mapper_object_test.go:272–286  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

270}
271
272func Test_Object_AutoMapper_StructToMap(t *testing.T) {
273 m := NewMapper()
274 from := &FromStruct{Name: "From", Sex: true, AA: "AA"}
275 to := make(map[string]interface{})
276 err := m.AutoMapper(from, &to)
277 if err != nil {
278 t.Error("RunResult error: mapper error", err)
279 } else {
280 if to["UserName"] == "From" {
281 t.Log("RunResult success:", to)
282 } else {
283 t.Error("RunResult failed: map[UserName]", to["UserName"])
284 }
285 }
286}
287
288func Test_Object_MapperMap(t *testing.T) {
289 m := NewMapper()

Callers

nothing calls this directly

Calls 2

NewMapperFunction · 0.85
AutoMapperMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…