| 286 | } |
| 287 | |
| 288 | func 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 | |
| 306 | func Test_Object_MapToSlice(t *testing.T) { |
| 307 | m := NewMapper() |