Created
July 18, 2018 21:15
-
-
Save valvesss/c3ac06a597bf25d466271275dd478fb3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package tests | |
import ( | |
"testing" | |
"io/ioutil" | |
"log" | |
"bytes" | |
"github.com/go-interpreter/wagon/wasm" | |
"github.com/go-interpreter/wagon/exec" | |
"github.com/go-interpreter/wagon/validate" | |
) | |
func TestExports(*testing.T) { | |
raw, err := ioutil.ReadFile("helloworld.wasm") | |
if err != nil { | |
log.Fatal("Could not read wasm file.") | |
} | |
m, err := wasm.ReadModule(bytes.NewReader(raw), nil) | |
if err != nil { | |
log.Fatalf("could not read module: %v", err) | |
} | |
val := validate.VerifyModule(m) | |
if val == nil { | |
log.Fatalf("could not verify module: %v", err) | |
} | |
vm, err := exec.NewVM(m) | |
if err != nil { | |
log.Fatalf("could not create VM: %v", err) | |
} | |
_ = vm | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment