1
0
mirror of https://github.com/go-task/task.git synced 2025-08-08 22:36:57 +02:00

Added tests for new inport taskfile logic

This commit is contained in:
Evgeny Abramovich
2020-01-29 11:25:11 +03:00
parent 8ff81562d2
commit d567e23e50
8 changed files with 67 additions and 3 deletions

View File

@@ -540,9 +540,13 @@ func TestIncludes(t *testing.T) {
Target: "default",
TrimSpace: true,
Files: map[string]string{
"main.txt": "main",
"included_directory.txt": "included_directory",
"included_taskfile.txt": "included_taskfile",
"main.txt": "main",
"included_directory.txt": "included_directory",
"included_directory_without_dir.txt": "included_directory_without_dir",
"included_taskfile_without_dir.txt": "included_taskfile_without_dir",
"./module2/included_directory_with_dir.txt": "included_directory_with_dir",
"./module2/included_taskfile_with_dir.txt": "included_taskfile_with_dir",
"./module3/os_related.txt": runtime.GOOS,
},
}
tt.Run(t)

View File

@@ -3,6 +3,19 @@ version: '2'
includes:
included: ./included
included_taskfile: ./Taskfile2.yml
included_without_dir:
taskfile: ./module1
included_taskfile_without_dir:
taskfile: ./module1/Taskfile.yml
included_with_dir:
taskfile: ./module2
dir: ./module2
included_taskfile_with_dir:
taskfile: ./module2/Taskfile.yml
dir: ./module2
os_related:
taskfile: ./module3/CustomTaskfile.yml
dir: ./module3
tasks:
default:
@@ -10,6 +23,11 @@ tasks:
- task: gen
- task: included:gen
- task: included_taskfile:gen
- task: included_without_dir:gen_file
- task: included_taskfile_without_dir:gen_dir
- task: included_with_dir:gen_file
- task: included_taskfile_with_dir:gen_dir
- task: os_related:gen
gen:
cmds:

View File

@@ -0,0 +1,9 @@
version: '2'
tasks:
gen_dir:
cmds:
- echo included_directory_without_dir > included_directory_without_dir.txt
gen_file:
cmds:
- echo included_taskfile_without_dir > included_taskfile_without_dir.txt

View File

@@ -0,0 +1,9 @@
version: '2'
tasks:
gen_dir:
cmds:
- echo included_directory_with_dir > included_directory_with_dir.txt
gen_file:
cmds:
- echo included_taskfile_with_dir > included_taskfile_with_dir.txt

View File

@@ -0,0 +1,6 @@
version: '2'
tasks:
gen:
cmds:
- echo "INVALID" > os_related.txt

View File

@@ -0,0 +1,6 @@
version: '2'
tasks:
gen:
cmds:
- echo "darwin" > os_related.txt

View File

@@ -0,0 +1,6 @@
version: '2'
tasks:
gen:
cmds:
- echo "linux" > os_related.txt

View File

@@ -0,0 +1,6 @@
version: '2'
tasks:
gen:
cmds:
- echo "windows" > os_related.txt