1
0
mirror of https://github.com/go-task/task.git synced 2025-01-12 04:34:11 +02:00

add unit test for full output

This commit is contained in:
jaedle 2019-02-24 17:20:29 +01:00
parent 890996f595
commit a4a20d92a4

View File

@ -102,3 +102,40 @@ func TestDoesNotPrintCommandIfMissing(t *testing.T) {
assert.NotContains(t, buffer.String(), "commands")
}
func TestFullSummary(t *testing.T) {
buffer := &bytes.Buffer{}
l := logger.Logger{
Stdout: buffer,
Stderr: buffer,
Verbose: false,
}
task := &taskfile.Task{
Task: "sample-task",
Summary: "line1\nline2\nline3\n",
Deps: []*taskfile.Dep{
{Task: "dependency"},
},
Cmds: []*taskfile.Cmd{
{Cmd: "command"},
},
}
summary.Print(&l, task)
expected :=
`task: sample-task
line1
line2
line3
dependencies:
- dependency
commands:
- command
`
assert.Equal(t, expected, buffer.String())
}