(t *testing.T)
| 463 | } |
| 464 | |
| 465 | func TestFieldMap(t *testing.T) { |
| 466 | type Foo struct { |
| 467 | A int |
| 468 | B int |
| 469 | C int |
| 470 | } |
| 471 | |
| 472 | f := Foo{1, 2, 3} |
| 473 | m := NewMapperFunc("db", strings.ToLower) |
| 474 | |
| 475 | fm := m.FieldMap(reflect.ValueOf(f)) |
| 476 | |
| 477 | if len(fm) != 3 { |
| 478 | t.Errorf("Expecting %d keys, got %d", 3, len(fm)) |
| 479 | } |
| 480 | if fm["a"].Interface().(int) != 1 { |
| 481 | t.Errorf("Expecting %d, got %d", 1, ival(fm["a"])) |
| 482 | } |
| 483 | if fm["b"].Interface().(int) != 2 { |
| 484 | t.Errorf("Expecting %d, got %d", 2, ival(fm["b"])) |
| 485 | } |
| 486 | if fm["c"].Interface().(int) != 3 { |
| 487 | t.Errorf("Expecting %d, got %d", 3, ival(fm["c"])) |
| 488 | } |
| 489 | } |
| 490 | |
| 491 | func TestTagNameMapping(t *testing.T) { |
| 492 | type Strategy struct { |
nothing calls this directly
no test coverage detected