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 <leon.gross@9elements.com>
  • Loading branch information
leongross committed Nov 13, 2024
1 parent 673d901 commit 5f0f0aa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
1 change: 1 addition & 0 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -926,6 +926,7 @@ endif
@cp -rp lib/musl/src/env build/release/tinygo/lib/musl/src
@cp -rp lib/musl/src/errno build/release/tinygo/lib/musl/src
@cp -rp lib/musl/src/exit build/release/tinygo/lib/musl/src
@cp -rp lib/musl/src/fcntl build/release/tinygo/lib/musl/src
@cp -rp lib/musl/src/include build/release/tinygo/lib/musl/src
@cp -rp lib/musl/src/internal build/release/tinygo/lib/musl/src
@cp -rp lib/musl/src/legacy build/release/tinygo/lib/musl/src
Expand Down
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 5f0f0aa

Please sign in to comment.