Files
wazero/examples/wasi/cat_test.go
Crypt Keeper 958ce19c0b Makes examples runnable and pares down list (#458)
This deduplicates examples, leaving only the most maintained or targeted
ones. Notably, this makes each runnable, avoiding test dependencies.

Signed-off-by: Adrian Cole <adrian@tetrate.io>
2022-04-13 16:03:50 +08:00

21 lines
344 B
Go

package main
import "os"
// ExampleMain ensures the following will work:
//
// go build cat.go
// ./cat ./test.txt
func ExampleMain() {
// Save the old os.Args and replace with our example input.
oldArgs := os.Args
os.Args = []string{"cat", "./test.txt"}
defer func() { os.Args = oldArgs }()
main()
// Output:
// hello filesystem
}