Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,32 @@ func TestReference(t *testing.T) {
}
}

func TestShVarWithIncludes(t *testing.T) {
t.Parallel()

tests := []struct {
name string
call string
}{
{
name: "sh var not clobbered by includes",
call: "default",
},
}

for _, test := range tests {
NewExecutorTest(t,
WithName(test.name),
WithExecutorOptions(
task.WithDir("testdata/var_sh_with_includes"),
task.WithSilent(true),
task.WithForce(true),
),
WithTask(cmp.Or(test.call, "default")),
)
}
}

func TestVarInheritance(t *testing.T) {
enableExperimentForTest(t, &experiments.EnvPrecedence, 1)
tests := []struct {
Expand Down
6 changes: 6 additions & 0 deletions testdata/var_sh_with_includes/Included.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: '3'

tasks:
noop:
cmds:
- "true"
18 changes: 18 additions & 0 deletions testdata/var_sh_with_includes/Taskfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: '3'

includes:
other:
taskfile: ./Included.yml
internal: true

vars:
DYNAMIC_VAR:
sh: echo "hello"
DERIVED_VAR: "{{.DYNAMIC_VAR}} world"

tasks:
default:
cmds:
- echo "DYNAMIC_VAR={{.DYNAMIC_VAR}}"
- echo "DERIVED_VAR={{.DERIVED_VAR}}"
silent: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
DYNAMIC_VAR=hello
DERIVED_VAR=hello world
Loading