aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/wasm/fmt_test.go
blob: d3695f072c568dc50b8c7a4bf84947a4485f30ea (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
32
package wasm

import (
	"testing"

	"github.com/chromedp/chromedp"
)

func TestFmt(t *testing.T) {

	wasmTmpDir, server := startServer(t)

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

	ctx, cancel := chromectx()
	defer cancel()

	var log1 string
	err = chromedp.Run(ctx,
		chromedp.Navigate(server.URL+"/run?file=fmt.wasm"),
		chromedp.InnerHTML("#log", &log1),
		waitLog(`did not panic`),
	)
	t.Logf("log1: %s", log1)
	if err != nil {
		t.Fatal(err)
	}

}