diff --git a/internal/compiler/compiler.go b/internal/compiler/compiler.go index db8aea5f..c3dfaee0 100644 --- a/internal/compiler/compiler.go +++ b/internal/compiler/compiler.go @@ -129,10 +129,10 @@ func (c *Compiler) getVariables(t *ast.Task, call *ast.Call, evaluateShVars bool return nil, err } if t != nil { - if err := t.IncludedTaskfileVars.Range(taskRangeFunc); err != nil { + if err := t.IncludeVars.Range(rangeFunc); err != nil { return nil, err } - if err := t.IncludeVars.Range(rangeFunc); err != nil { + if err := t.IncludedTaskfileVars.Range(taskRangeFunc); err != nil { return nil, err } } diff --git a/task_test.go b/task_test.go index b3035cb1..bf798bfa 100644 --- a/task_test.go +++ b/task_test.go @@ -1785,7 +1785,7 @@ Hello bar `) require.NoError(t, e.Run(context.Background(), &ast.Call{Task: "default"})) t.Log(buff.String()) - assert.Equal(t, strings.TrimSpace(buff.String()), expectedOutputOrder) + assert.Equal(t, expectedOutputOrder, strings.TrimSpace(buff.String())) } func TestErrorCode(t *testing.T) { diff --git a/testdata/include_with_vars_multi_level/lib/Taskfile.yml b/testdata/include_with_vars_multi_level/lib/Taskfile.yml index 43ac52e9..1f59bc44 100644 --- a/testdata/include_with_vars_multi_level/lib/Taskfile.yml +++ b/testdata/include_with_vars_multi_level/lib/Taskfile.yml @@ -1,7 +1,7 @@ version: "3" vars: - RECEIVER: "world" + RECEIVER: '{{ .RECEIVER | default "world" }}' tasks: greet: