Skip to content

Commit

Permalink
nit: update main_test.go
Browse files Browse the repository at this point in the history
Signed-off-by: leongross <[email protected]>
  • Loading branch information
leongross committed Nov 11, 2024
1 parent 182dd87 commit e2e6576
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,7 @@ func emuCheck(t *testing.T, options compileopts.Options) {
}
if spec.Emulator != "" {
emulatorCommand := strings.SplitN(spec.Emulator, " ", 2)[0]
_, err := exec.LookPath(emulatorCommand)
if err != nil {
if _, err := exec.LookPath(emulatorCommand); err != nil {
if errors.Is(err, exec.ErrNotFound) {
t.Skipf("emulator not installed: %q", emulatorCommand)
}
Expand Down Expand Up @@ -668,8 +667,7 @@ func TestWasmExport(t *testing.T) {
builder := r.NewHostModuleBuilder("tester")
builder.NewFunctionBuilder().WithFunc(callOutside).Export("callOutside")
builder.NewFunctionBuilder().WithFunc(callTestMain).Export("callTestMain")
_, err = builder.Instantiate(ctx)
if err != nil {
if _, err = builder.Instantiate(ctx); err != nil {
t.Fatal(err)
}

Expand Down Expand Up @@ -719,8 +717,7 @@ func TestWasmFuncOf(t *testing.T) {
cmd := exec.Command("node", "testdata/wasmfunc.js", result.Binary, buildConfig.BuildMode())
cmd.Stdout = output
cmd.Stderr = output
err = cmd.Run()
if err != nil {
if err = cmd.Run(); err != nil {
t.Error("failed to run node:", err)
}
checkOutput(t, "testdata/wasmfunc.txt", output.Bytes())
Expand Down Expand Up @@ -757,8 +754,8 @@ func TestWasmExportJS(t *testing.T) {
cmd := exec.Command("node", "testdata/wasmexport.js", result.Binary, buildConfig.BuildMode())
cmd.Stdout = output
cmd.Stderr = output
err = cmd.Run()
if err != nil {

if err = cmd.Run(); err != nil {
t.Error("failed to run node:", err)
}
checkOutput(t, "testdata/wasmexport.txt", output.Bytes())
Expand Down Expand Up @@ -979,8 +976,7 @@ func TestMain(m *testing.M) {
switch os.Args[1] {
case "clang", "ld.lld", "wasm-ld":
// Invoke a specific tool.
err := builder.RunTool(os.Args[1], os.Args[2:]...)
if err != nil {
if err := builder.RunTool(os.Args[1], os.Args[2:]...); err != nil {
// The tool should have printed an error message already.
// Don't print another error message here.
os.Exit(1)
Expand Down

0 comments on commit e2e6576

Please sign in to comment.