diff --git a/internal/execute/execute_test.go b/internal/execute/execute_test.go index 6b0371601..9f84babe3 100644 --- a/internal/execute/execute_test.go +++ b/internal/execute/execute_test.go @@ -28,7 +28,8 @@ func TestNewExpression(t *testing.T) { func TestRun_Command(t *testing.T) { t.Run("command is executed with bash", func(t *testing.T) { - cmd := New("echo $(type -a sh);", []string{}) + // "type" (bash) output is locale sensitive + cmd := New("echo $(LANG=C type -a sh);", []string{}) var stdout strings.Builder cmd.Stdout = &stdout @@ -130,7 +131,8 @@ func TestRun_Command(t *testing.T) { func TestRun_Expression(t *testing.T) { t.Run("expression is executed with bash", func(t *testing.T) { - cmd := NewExpression("echo $(type -a sh)", []string{}) + // "type" (bash) output is locale sensitive + cmd := NewExpression("echo $(LANG=C type -a sh)", []string{}) var stdout strings.Builder cmd.Stdout = &stdout diff --git a/internal/git/git_test.go b/internal/git/git_test.go index 8d5b77dfa..daa3601a9 100644 --- a/internal/git/git_test.go +++ b/internal/git/git_test.go @@ -12,6 +12,8 @@ import ( ) func TestRepoClone(t *testing.T) { + t.Setenv("LANG", "C") // error messages from git are locale dependent + t.Run("when repo name is valid but URL is invalid prints an error", func(t *testing.T) { repo := NewRepo(t.TempDir()) err := repo.Clone("foobar", "") @@ -94,6 +96,8 @@ func TestRepoRemoteURL(t *testing.T) { } func TestRepoUpdate(t *testing.T) { + t.Setenv("LANG", "C") // error messages from git are locale dependent + repoDir := generateRepo(t) directory := t.TempDir() diff --git a/internal/plugins/plugins_test.go b/internal/plugins/plugins_test.go index e17035ceb..65a121f46 100644 --- a/internal/plugins/plugins_test.go +++ b/internal/plugins/plugins_test.go @@ -125,6 +125,8 @@ func TestAdd(t *testing.T) { }) t.Run("when plugin name is valid but URL is invalid prints an error", func(t *testing.T) { + t.Setenv("LANG", "C") // git error messages are locale dependent + conf := config.Config{DataDir: testDataDir} err := Add(conf, "foo", "foobar", "")