1
0
mirror of https://github.com/taigrr/go-fastping synced 2025-01-18 05:03:15 -08:00

Fixed RunLoop test in the same way as an example

This commit is contained in:
Tatsushi Demachi 2014-04-22 00:08:42 +09:00
parent e5a0822b78
commit 5d1967e357

View File

@ -180,13 +180,17 @@ func TestRunLoop(t *testing.T) {
wait := make(chan bool) wait := make(chan bool)
quit, errch := p.RunLoop() quit, errch := p.RunLoop()
ticker := time.NewTicker(time.Millisecond * 250) ticker := time.NewTicker(time.Millisecond * 250)
select { loop:
case err := <-errch: for {
t.Fatalf("Pinger returns error %v", err) select {
case <-ticker.C: case err := <-errch:
quit <- wait t.Fatalf("Pinger returns error %v", err)
case <-wait: case <-ticker.C:
break ticker.Stop()
quit <- wait
case <-wait:
break loop
}
} }
if recvCount < 2 { if recvCount < 2 {