Revert "audio: No need goroutine for tests"

This reverts commit 7740656054.
This commit is contained in:
Hajime Hoshi 2018-12-28 02:15:11 +09:00
parent 042b30a516
commit 62a9bb195c

View File

@ -71,14 +71,20 @@ func TestGC(t *testing.T) {
p = nil p = nil
runtime.GC() runtime.GC()
for i := 0; i < 10; i++ { ch := make(chan struct{})
got = PlayersNumForTesting() go func() {
if want := 0; got == want { defer close(ch)
return for i := 0; i < 10; i++ {
got = PlayersNumForTesting()
if want := 0; got == want {
return
}
// 100[ms] should be enough all the bytes are consumed.
// TODO: This is a darty hack. Would it be possible to use virtual time?
time.Sleep(100 * time.Millisecond)
} }
// 100[ms] should be enough all the bytes are consumed. t.Errorf("time out")
// TODO: This is a darty hack. Would it be possible to use virtual time? }()
time.Sleep(100 * time.Millisecond)
} <-ch
t.Errorf("time out")
} }