mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
Revert "Revert "audio: No need goroutine for tests""
This reverts commit 62a9bb195c
.
This commit is contained in:
parent
62a9bb195c
commit
7956e0ebbc
@ -71,20 +71,14 @@ func TestGC(t *testing.T) {
|
||||
p = nil
|
||||
runtime.GC()
|
||||
|
||||
ch := make(chan struct{})
|
||||
go func() {
|
||||
defer close(ch)
|
||||
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)
|
||||
for i := 0; i < 10; i++ {
|
||||
got = PlayersNumForTesting()
|
||||
if want := 0; got == want {
|
||||
return
|
||||
}
|
||||
t.Errorf("time out")
|
||||
}()
|
||||
|
||||
<-ch
|
||||
// 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)
|
||||
}
|
||||
t.Errorf("time out")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user