mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-11-25 14:35:59 +00:00
test case
This commit is contained in:
parent
bb72264994
commit
a624e50ffe
@ -78,7 +78,7 @@ func (m *SessionManager) CloseIfNoSession() bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(m.sessions) > 0 {
|
if len(m.sessions) != 0 {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -24,3 +24,14 @@ func TestSessionManagerAdd(t *testing.T) {
|
|||||||
m.Add(s)
|
m.Add(s)
|
||||||
assert.Uint16(s.ID).Equals(4)
|
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()
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user