Skip to content

Commit

Permalink
internal/shaderlister: bug fix: skip tests when Go is not found (e.g.…
Browse files Browse the repository at this point in the history
… Wasm)

Updates #3157
  • Loading branch information
hajimehoshi committed Nov 10, 2024
1 parent 75d7a26 commit 864f826
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions internal/shaderlister/shaderlister_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,18 @@ import (
"testing"
)

func hasGoCommand() bool {
if _, err := exec.LookPath("go"); err != nil {
return false
}
return true
}

func TestRun(t *testing.T) {
if !hasGoCommand() {
t.Skip("go command is missing")
}

cmd := exec.Command("go", "run", "github.com/hajimehoshi/ebiten/v2/internal/shaderlister", "github.com/hajimehoshi/ebiten/v2/internal/shaderlister/shaderlistertest")
out, err := cmd.Output()
if err != nil {
Expand Down Expand Up @@ -66,6 +77,10 @@ func TestRun(t *testing.T) {
}

func TestEmpty(t *testing.T) {
if !hasGoCommand() {
t.Skip("go command is missing")
}

cmd := exec.Command("go", "run", "github.com/hajimehoshi/ebiten/v2/internal/shaderlister", "github.com/ebitengine/purego")
out, err := cmd.Output()
if err != nil {
Expand Down

0 comments on commit 864f826

Please sign in to comment.