github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/tests/wasm/chan_test.go (about)

     1  package wasm
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/chromedp/chromedp"
     7  )
     8  
     9  func TestChan(t *testing.T) {
    10  
    11  	wasmTmpDir, server := startServer(t)
    12  
    13  	err := run(t, "tinygo build -o "+wasmTmpDir+"/chan.wasm -target wasm testdata/chan.go")
    14  	if err != nil {
    15  		t.Fatal(err)
    16  	}
    17  
    18  	ctx := chromectx(t)
    19  
    20  	err = chromedp.Run(ctx,
    21  		chromedp.Navigate(server.URL+"/run?file=chan.wasm"),
    22  		waitLog(`1
    23  4
    24  2
    25  3
    26  true`),
    27  	)
    28  	if err != nil {
    29  		t.Fatal(err)
    30  	}
    31  }