MCPcopy Create free account
hub / github.com/devfeel/mapper / Test_Object_MapperMap

Function Test_Object_MapperMap

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

Source from the content-addressed store, hash-verified

286}
287
288func Test_Object_MapperMap(t *testing.T) {
289 m := NewMapper()
290 validateTime, _ := time.Parse("2006-01-02 15:04:05", "2017-01-01 10:00:00")
291 fromMap := make(map[string]interface{})
292 fromMap["Name"] = "test"
293 fromMap["Sex"] = true
294 fromMap["Age"] = 10
295 fromMap["Time"] = validateTime
296 fromMap["Time2"] = validateTime
297 toObj := &testStruct{}
298 err := m.MapperMap(fromMap, toObj)
299 if err != nil && toObj.Time != validateTime {
300 t.Error("RunResult error: mapper error", err)
301 } else {
302 t.Log("RunResult success:", toObj)
303 }
304}
305
306func Test_Object_MapToSlice(t *testing.T) {
307 m := NewMapper()

Callers

nothing calls this directly

Calls 2

NewMapperFunction · 0.85
MapperMapMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…