diff options
Diffstat (limited to 'testdata/goroutines.go')
-rw-r--r-- | testdata/goroutines.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/testdata/goroutines.go b/testdata/goroutines.go index e3cc62fa7..eb38a5b1f 100644 --- a/testdata/goroutines.go +++ b/testdata/goroutines.go @@ -75,6 +75,8 @@ func main() { testGoOnBuiltins() + testGoOnInterface(Foo(0)) + testCond() testIssue1790() @@ -203,6 +205,14 @@ func testCond() { var once sync.Once +func testGoOnInterface(f Itf) { + go f.Nowait() + time.Sleep(time.Millisecond) + go f.Wait() + time.Sleep(time.Millisecond * 2) + println("done with 'go on interface'") +} + // This tests a fix for issue 1790: // https://github.com/tinygo-org/tinygo/issues/1790 func testIssue1790() *int { @@ -210,3 +220,20 @@ func testIssue1790() *int { i := 0 return &i } + +type Itf interface { + Nowait() + Wait() +} + +type Foo string + +func (f Foo) Nowait() { + println("called: Foo.Nowait") +} + +func (f Foo) Wait() { + println("called: Foo.Wait") + time.Sleep(time.Microsecond) + println(" ...waited") +} |