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

Function Test_MapperMap

mapper_test.go:333–348  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

331}
332
333func Test_MapperMap(t *testing.T) {
334 validateTime, _ := time.Parse("2006-01-02 15:04:05", "2017-01-01 10:00:00")
335 fromMap := make(map[string]interface{})
336 fromMap["Name"] = "test"
337 fromMap["Sex"] = true
338 fromMap["Age"] = 10
339 fromMap["Time"] = validateTime
340 fromMap["Time2"] = validateTime
341 toObj := &testStruct{}
342 err := MapperMap(fromMap, toObj)
343 if err != nil && toObj.Time != validateTime {
344 t.Error("RunResult error: mapper error", err)
345 } else {
346 t.Log("RunResult success:", toObj)
347 }
348}
349
350func Test_MapToSlice(t *testing.T) {
351 var toSlice []*testStruct

Callers

nothing calls this directly

Calls 1

MapperMapFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…