MCPcopy Create free account
hub / github.com/golobby/container / TestContainer_Fill_Unexported_With_Struct_Pointer

Function TestContainer_Fill_Unexported_With_Struct_Pointer

container_test.go:505–527  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

503}
504
505func TestContainer_Fill_Unexported_With_Struct_Pointer(t *testing.T) {
506 err := instance.Singleton(func() Shape {
507 return &Circle{a: 5}
508 })
509 assert.NoError(t, err)
510
511 err = instance.Singleton(func() Database {
512 return &MySQL{}
513 })
514 assert.NoError(t, err)
515
516 myApp := struct {
517 s Shape `container:"type"`
518 d Database `container:"type"`
519 y int
520 }{}
521
522 err = instance.Fill(&myApp)
523 assert.NoError(t, err)
524
525 assert.IsType(t, &Circle{}, myApp.s)
526 assert.IsType(t, &MySQL{}, myApp.d)
527}
528
529func TestContainer_Fill_With_Invalid_Field_It_Should_Fail(t *testing.T) {
530 err := instance.NamedSingleton("C", func() Shape {

Callers

nothing calls this directly

Calls 2

SingletonMethod · 0.80
FillMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…