From 864f826b3cead7b1b965b2c8b7a539aeef5d5512 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sun, 10 Nov 2024 23:34:46 +0900 Subject: [PATCH] internal/shaderlister: bug fix: skip tests when Go is not found (e.g. Wasm) Updates #3157 --- internal/shaderlister/shaderlister_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/internal/shaderlister/shaderlister_test.go b/internal/shaderlister/shaderlister_test.go index 86e4d3ac0..1e1480ff7 100644 --- a/internal/shaderlister/shaderlister_test.go +++ b/internal/shaderlister/shaderlister_test.go @@ -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 { @@ -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 {