From 1986937da8a866666945406283950e507afe1ff1 Mon Sep 17 00:00:00 2001 From: leongross Date: Mon, 11 Nov 2024 13:31:34 +0100 Subject: [PATCH] nit: update main_test.go Signed-off-by: leongross --- main_test.go | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/main_test.go b/main_test.go index ecff134275..f4f08e3c88 100644 --- a/main_test.go +++ b/main_test.go @@ -341,8 +341,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) } @@ -672,8 +671,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) } @@ -730,8 +728,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()) @@ -771,8 +768,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()) @@ -1037,8 +1034,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)