mirror of
https://github.com/go-task/task.git
synced 2025-07-17 01:43:07 +02:00
add basic test for details
This commit is contained in:
15
task_test.go
15
task_test.go
@ -553,3 +553,18 @@ func TestIncludesCallingRoot(t *testing.T) {
|
|||||||
}
|
}
|
||||||
tt.Run(t)
|
tt.Run(t)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestDetails(t *testing.T) {
|
||||||
|
const dir = "testdata/details"
|
||||||
|
|
||||||
|
var buff bytes.Buffer
|
||||||
|
e := task.Executor{
|
||||||
|
Dir: dir,
|
||||||
|
Stdout: &buff,
|
||||||
|
Stderr: &buff,
|
||||||
|
Details: 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")
|
||||||
|
assert.Equal(t, e.Taskfile.Tasks["task-without-details"].Details, "")
|
||||||
|
}
|
||||||
|
12
testdata/details/Taskfile.yml
vendored
Normal file
12
testdata/details/Taskfile.yml
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
version: 2
|
||||||
|
tasks:
|
||||||
|
task-with-details:
|
||||||
|
details: |
|
||||||
|
This is a very long detailed description
|
||||||
|
with multiple lines
|
||||||
|
cmds:
|
||||||
|
- exit 0
|
||||||
|
|
||||||
|
task-without-details:
|
||||||
|
cmds:
|
||||||
|
- exit 0
|
Reference in New Issue
Block a user