Files
wazero/examples/wasi/cat_test.go
Crypt Keeper c4caa1ea9b Changes how examples are tested, and fixes ExitError bug (#468)
Before, we tested the examples/ directory using "ExampleXX", but this is
not ideal because it literally embeds the call to `main` into example
godoc output. This stops doing that for a different infrastructure.

This also makes sure there's a godoc example for both the main package
and wasi, so that people looking at https://pkg.go.dev see something and
also a link to our real examples directory.

Signed-off-by: Adrian Cole <adrian@tetrate.io>
2022-04-15 15:51:27 +08:00

17 lines
387 B
Go

package wasi_example
import (
"testing"
"github.com/tetratelabs/wazero/internal/testing/maintester"
"github.com/tetratelabs/wazero/internal/testing/require"
)
// Test_main ensures the following will work:
//
// go run cat.go ./test.txt
func Test_main(t *testing.T) {
stdout, _ := maintester.TestMain(t, main, "cat", "./test.txt")
require.Equal(t, "hello filesystem\n", stdout)
}