test case

pull/642/head
Darien Raymond 2017-04-19 12:36:04 +02:00
parent bb72264994
commit a624e50ffe
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
2 changed files with 12 additions and 1 deletions

View File

@ -78,7 +78,7 @@ func (m *SessionManager) CloseIfNoSession() bool {
return true
}
if len(m.sessions) > 0 {
if len(m.sessions) != 0 {
return false
}

View File

@ -24,3 +24,14 @@ func TestSessionManagerAdd(t *testing.T) {
m.Add(s)
assert.Uint16(s.ID).Equals(4)
}
func TestSessionManagerClose(t *testing.T) {
assert := assert.On(t)
m := NewSessionManager()
s := m.Allocate()
assert.Bool(m.CloseIfNoSession()).IsFalse()
m.Remove(s.ID)
assert.Bool(m.CloseIfNoSession()).IsTrue()
}