mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-26 22:04:32 +02:00
@@ -5,16 +5,16 @@
|
||||
package testenv_test
|
||||
|
||||
import (
|
||||
"github.com/gohugoio/hugo/tpl/internal/go_templates/testenv"
|
||||
//"internal/platform"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/gohugoio/hugo/tpl/internal/go_templates/testenv"
|
||||
)
|
||||
|
||||
func TestGoToolLocation(t *testing.T) {
|
||||
t.Skip("skipping test that requires go command")
|
||||
testenv.MustHaveGoBuild(t)
|
||||
|
||||
var exeSuffix string
|
||||
@@ -53,3 +53,33 @@ func TestGoToolLocation(t *testing.T) {
|
||||
t.Fatalf("%q is not the same file as %q", absWant, goTool)
|
||||
}
|
||||
}
|
||||
|
||||
func TestHasGoBuild(t *testing.T) {
|
||||
// Removed by Hugo.
|
||||
}
|
||||
|
||||
func TestMustHaveExec(t *testing.T) {
|
||||
hasExec := false
|
||||
t.Run("MustHaveExec", func(t *testing.T) {
|
||||
testenv.MustHaveExec(t)
|
||||
t.Logf("MustHaveExec did not skip")
|
||||
hasExec = true
|
||||
})
|
||||
|
||||
switch runtime.GOOS {
|
||||
case "js", "wasip1":
|
||||
if hasExec {
|
||||
// js and wasip1 lack an “exec” syscall.
|
||||
t.Errorf("expected MustHaveExec to skip on %v", runtime.GOOS)
|
||||
}
|
||||
case "ios":
|
||||
if b := testenv.Builder(); strings.HasSuffix(b, "-corellium") && !hasExec {
|
||||
// Most ios environments can't exec, but the corellium builder can.
|
||||
t.Errorf("expected MustHaveExec not to skip on %v", b)
|
||||
}
|
||||
default:
|
||||
if b := testenv.Builder(); b != "" && !hasExec {
|
||||
t.Errorf("expected MustHaveExec not to skip on %v", b)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user