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

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