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:
29
task_test.go
29
task_test.go
@ -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"
|
||||
|
Reference in New Issue
Block a user