diff options
author | Anton Titov <[email protected]> | 2019-12-23 14:52:06 +0300 |
---|---|---|
committer | GitHub <[email protected]> | 2019-12-23 14:52:06 +0300 |
commit | 921e1f55e23ab75b8250045916c8d1ffad1b8bde (patch) | |
tree | 00b16331b9ff3b3b846ba22989dddde721cc959d /service/container_test.go | |
parent | 921354df1aa4687837e3ba6ac0eb04d39321c149 (diff) | |
parent | 2093cb9058f94668fff0a97beb76b0cab66c7b63 (diff) |
Merge branch 'master' into Fix_warning_and_issues
Diffstat (limited to 'service/container_test.go')
-rw-r--r-- | service/container_test.go | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/service/container_test.go b/service/container_test.go index 33ad9491..5350de41 100644 --- a/service/container_test.go +++ b/service/container_test.go @@ -132,6 +132,20 @@ func TestContainer_Has(t *testing.T) { assert.False(t, c.Has("another")) } +func TestContainer_List(t *testing.T) { + logger, hook := test.NewNullLogger() + logger.SetLevel(logrus.DebugLevel) + + c := NewContainer(logger) + c.Register("test", &testService{}) + + assert.Equal(t, 0, len(hook.Entries)) + assert.Equal(t, 1, len(c.List())) + + assert.True(t, c.Has("test")) + assert.False(t, c.Has("another")) +} + func TestContainer_Get(t *testing.T) { logger, hook := test.NewNullLogger() logger.SetLevel(logrus.DebugLevel) @@ -428,6 +442,10 @@ func TestContainer_InitErrorB(t *testing.T) { type testInitC struct{} +func (r *testInitC) Test() bool { + return true +} + func TestContainer_NoInit(t *testing.T) { logger, _ := test.NewNullLogger() logger.SetLevel(logrus.DebugLevel) @@ -449,7 +467,6 @@ func (c *DCfg) Hydrate(cfg Config) error { if err := cfg.Unmarshal(c); err != nil { return err } - if c.V == "fail" { return errors.New("failed config") } |