tinygo/tests/wasm/chan_test.go
Brad Peabody 95f509b109
wasm test suite (#1116)
* wasm: add test suite using headlless chrome
2020-05-23 14:12:01 +02:00

34 строки
468 Б
Go

package wasm
import (
"testing"
"time"
"github.com/chromedp/chromedp"
)
func TestChan(t *testing.T) {
t.Parallel()
err := run("tinygo build -o " + wasmTmpDir + "/chan.wasm -target wasm testdata/chan.go")
if err != nil {
t.Fatal(err)
}
ctx, cancel := chromectx(5 * time.Second)
defer cancel()
err = chromedp.Run(ctx,
chromedp.Navigate("http://localhost:8826/run?file=chan.wasm"),
waitLog(`1
2
4
3
true`),
)
if err != nil {
t.Fatal(err)
}
}