Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
vmaerten committed May 8, 2024
1 parent b738c04 commit 68aad36
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions task_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (

"github.com/go-task/task/v3"
"github.com/go-task/task/v3/errors"
"github.com/go-task/task/v3/internal/experiments"
"github.com/go-task/task/v3/internal/filepathext"
"github.com/go-task/task/v3/taskfile/ast"
)
Expand Down Expand Up @@ -70,7 +71,6 @@ func (fct fileContentTest) Run(t *testing.T) {

require.NoError(t, e.Setup(), "e.Setup()")
require.NoError(t, e.Run(context.Background(), &ast.Call{Task: fct.Target}), "e.Run(target)")

for name, expectContent := range fct.Files {
t.Run(fct.name(name), func(t *testing.T) {
path := filepathext.SmartJoin(e.Dir, name)
Expand All @@ -96,21 +96,20 @@ func TestEmptyTask(t *testing.T) {
}

func TestEnv(t *testing.T) {
t.Setenv("QUX", "from_env")
t.Setenv("QUX", "from_os")
tt := fileContentTest{
Dir: "testdata/env",
Target: "default",
TrimSpace: false,
Files: map[string]string{
"local.txt": "GOOS='linux' GOARCH='amd64' CGO_ENABLED='0'\n",
"global.txt": "FOO='foo' BAR='overriden' BAZ='baz'\n",
"not-overriden.txt": "QUX='from_env'\n",
"not-overriden.txt": "QUX='from_os'\n",
},
}
tt.Run(t)

t.Setenv("TASK_X_ENV_PRECEDENCE", "1")

experiments.EnvPrecedence = experiments.New("ENV_PRECEDENCE")
ttt := fileContentTest{
Dir: "testdata/env",
Target: "overriden",
Expand Down

0 comments on commit 68aad36

Please sign in to comment.