aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/wasm/chan_test.go
blob: c22410f63f36b7dc23ec25869b2e11aa1ea2d798 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package wasm

import (
	"testing"

	"github.com/chromedp/chromedp"
)

func TestChan(t *testing.T) {

	wasmTmpDir, server := startServer(t)

	err := run(t, "tinygo build -o "+wasmTmpDir+"/chan.wasm -target wasm testdata/chan.go")
	if err != nil {
		t.Fatal(err)
	}

	ctx := chromectx(t)

	err = chromedp.Run(ctx,
		chromedp.Navigate(server.URL+"/run?file=chan.wasm"),
		waitLog(`1
4
2
3
true`),
	)
	if err != nil {
		t.Fatal(err)
	}
}