1
0
mirror of https://github.com/go-task/task.git synced 2025-06-15 00:15:10 +02:00

Merge pull request #656 from tylermmorton/master

Add support for multi-level includes
This commit is contained in:
Andrey Nering
2022-03-31 21:12:15 -03:00
committed by GitHub
14 changed files with 152 additions and 20 deletions

View File

@ -753,6 +753,35 @@ func TestIncludes(t *testing.T) {
tt.Run(t)
}
func TestIncludesMultiLevel(t *testing.T) {
tt := fileContentTest{
Dir: "testdata/includes_multi_level",
Target: "default",
TrimSpace: true,
Files: map[string]string{
"called_one.txt": "one",
"called_two.txt": "two",
"called_three.txt": "three",
},
}
tt.Run(t)
}
func TestIncludeCycle(t *testing.T) {
const dir = "testdata/includes_cycle"
expectedError := "task: include cycle detected between testdata/includes_cycle/Taskfile.yml <--> testdata/includes_cycle/one/two/Taskfile.yml"
var buff bytes.Buffer
e := task.Executor{
Dir: dir,
Stdout: &buff,
Stderr: &buff,
Silent: true,
}
assert.EqualError(t, e.Setup(), expectedError)
}
func TestIncorrectVersionIncludes(t *testing.T) {
const dir = "testdata/incorrect_includes"
expectedError := "task: Import with additional parameters is only available starting on Taskfile version v3"