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 13, 2024
1 parent 673d901 commit 1986937
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 @@ -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)
}
Expand Down Expand Up @@ -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)
}

Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 1986937

Please sign in to comment.