(t *testing.T)
| 473 | } |
| 474 | |
| 475 | func TestContainer_Fill_With_Struct_Pointer(t *testing.T) { |
| 476 | err := instance.Singleton(func() Shape { |
| 477 | return &Circle{a: 5} |
| 478 | }) |
| 479 | assert.NoError(t, err) |
| 480 | |
| 481 | err = instance.NamedSingleton("C", func() Shape { |
| 482 | return &Circle{a: 5} |
| 483 | }) |
| 484 | assert.NoError(t, err) |
| 485 | |
| 486 | err = instance.Singleton(func() Database { |
| 487 | return &MySQL{} |
| 488 | }) |
| 489 | assert.NoError(t, err) |
| 490 | |
| 491 | myApp := struct { |
| 492 | S Shape `container:"type"` |
| 493 | D Database `container:"type"` |
| 494 | C Shape `container:"name"` |
| 495 | X string |
| 496 | }{} |
| 497 | |
| 498 | err = instance.Fill(&myApp) |
| 499 | assert.NoError(t, err) |
| 500 | |
| 501 | assert.IsType(t, &Circle{}, myApp.S) |
| 502 | assert.IsType(t, &MySQL{}, myApp.D) |
| 503 | } |
| 504 | |
| 505 | func TestContainer_Fill_Unexported_With_Struct_Pointer(t *testing.T) { |
| 506 | err := instance.Singleton(func() Shape { |
nothing calls this directly
no test coverage detected
searching dependent graphs…