mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-07 12:33:42 +00:00
tests: de-flake goroutines test
This commit is contained in:
Vendored
+4
@@ -175,10 +175,13 @@ func testGoOnBuiltins() {
|
||||
|
||||
var once sync.Once
|
||||
|
||||
var waitChan = make(chan struct{})
|
||||
|
||||
func testGoOnInterface(f Itf) {
|
||||
go f.Nowait()
|
||||
time.Sleep(time.Millisecond)
|
||||
go f.Wait()
|
||||
<-waitChan
|
||||
time.Sleep(time.Millisecond * 2)
|
||||
println("done with 'go on interface'")
|
||||
}
|
||||
@@ -204,6 +207,7 @@ func (f Foo) Nowait() {
|
||||
|
||||
func (f Foo) Wait() {
|
||||
println("called: Foo.Wait")
|
||||
close(waitChan)
|
||||
time.Sleep(time.Microsecond)
|
||||
println(" ...waited")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user