test limit
This commit is contained in:
parent
f31b2fb74f
commit
499c90ccda
1 changed files with 17 additions and 0 deletions
17
hub_test.go
17
hub_test.go
|
@ -67,3 +67,20 @@ func TestOrder(t *testing.T) {
|
|||
t.Error("wrong last message", r[1])
|
||||
}
|
||||
}
|
||||
|
||||
func TestLimit(t *testing.T) {
|
||||
h := NewHub(5)
|
||||
go h.Run()
|
||||
for i := 0; i < 10; i++ {
|
||||
h.LogMessages <- msg("hi")
|
||||
}
|
||||
|
||||
if hubCount(h) != 5 {
|
||||
t.Error("wrong message number")
|
||||
}
|
||||
|
||||
r := hubToArrayOpt(h, ClientOptions{Nofollow: true, BacklogLength: 3})
|
||||
if len(r) != 3 {
|
||||
t.Error("non-limited!", r)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue