Skip to content
This repository has been archived by the owner on Oct 18, 2021. It is now read-only.

Commit

Permalink
Added tests for closeAll
Browse files Browse the repository at this point in the history
  • Loading branch information
dustin committed Mar 11, 2014
1 parent 987fd94 commit 6bf6082
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions util_test.go
Expand Up @@ -4,6 +4,24 @@ import (
"testing"
)

func TestCloseAllEmpty(t *testing.T) {
closeAll([]chan int{})
}

func TestCloseAllTwo(t *testing.T) {
ichan := make(chan int)
i2chan := make(chan int)
closeAll([]chan int{ichan, i2chan})
_, ok := <-ichan
if ok {
t.Errorf("ichan wasn't closed")
}
_, ok = <-i2chan
if ok {
t.Errorf("bchan wasn't closed")
}
}

func buildTestChans(n int) []chan int {
s := make([]chan int, 0, n)
for i := 0; i < n; i++ {
Expand Down

0 comments on commit 6bf6082

Please sign in to comment.