mirror of
https://github.com/go-task/task.git
synced 2025-02-09 13:47:06 +02:00
add more tests for details
This commit is contained in:
parent
f9adeba7f1
commit
a951f2403d
16
task_test.go
16
task_test.go
@ -563,8 +563,22 @@ func TestDetails(t *testing.T) {
|
||||
Stdout: &buff,
|
||||
Stderr: &buff,
|
||||
Details: true,
|
||||
Silent: true,
|
||||
}
|
||||
assert.NoError(t, e.Setup())
|
||||
assert.Equal(t, e.Taskfile.Tasks["task-with-details"].Details, "This is a very long detailed description\nwith multiple lines\n")
|
||||
const longDetails = "This is a very long detailed description\nwith multiple lines\n"
|
||||
assert.Equal(t, e.Taskfile.Tasks["task-with-details"].Details, longDetails)
|
||||
const shortDetails = "short details"
|
||||
assert.Equal(t, e.Taskfile.Tasks["other-task-with-details"].Details, shortDetails)
|
||||
assert.Equal(t, e.Taskfile.Tasks["task-without-details"].Details, "")
|
||||
|
||||
assert.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "task-with-details"}))
|
||||
assert.NotContains(t, buff.String(), "task-with-details was executed")
|
||||
assert.NotContains(t, buff.String(), "dependend-task was executed")
|
||||
assert.Contains(t, buff.String(), longDetails)
|
||||
|
||||
assert.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "task-without-details"}))
|
||||
assert.NotContains(t, buff.String(), "task-without-details was executed")
|
||||
assert.NotContains(t, buff.String(), "dependend-task was executed")
|
||||
|
||||
}
|
||||
|
15
testdata/details/Taskfile.yml
vendored
15
testdata/details/Taskfile.yml
vendored
@ -1,12 +1,23 @@
|
||||
version: 2
|
||||
tasks:
|
||||
task-with-details:
|
||||
deps: [dependend-task]
|
||||
details: |
|
||||
This is a very long detailed description
|
||||
with multiple lines
|
||||
cmds:
|
||||
- exit 0
|
||||
- echo 'task-with-details was executed'
|
||||
|
||||
task-without-details:
|
||||
deps: [dependend-task]
|
||||
cmds:
|
||||
- exit 0
|
||||
- echo 'task-without-details was executed'
|
||||
|
||||
dependend-task:
|
||||
cmds:
|
||||
- echo 'dependend-task was executed'
|
||||
|
||||
other-task-with-details:
|
||||
details: short details
|
||||
cmds:
|
||||
- echo 'other-task-with-details was executed'
|
||||
|
Loading…
x
Reference in New Issue
Block a user