Merge branch 'group-begin-message' of https://github.com/janslow/task into janslow-group-begin-message

This commit is contained in:
Andrey Nering
2022-02-19 18:42:34 -03:00
14 changed files with 270 additions and 36 deletions

View File

@@ -1193,3 +1193,28 @@ func TestIgnoreNilElements(t *testing.T) {
})
}
}
func TestOutputGroup(t *testing.T) {
const dir = "testdata/output_group"
var buff bytes.Buffer
e := task.Executor{
Dir: dir,
Stdout: &buff,
Stderr: &buff,
}
assert.NoError(t, e.Setup())
expectedOutputOrder := strings.TrimSpace(`
task: [hello] echo 'Hello!'
::group::hello
Hello!
::endgroup::
task: [bye] echo 'Bye!'
::group::bye
Bye!
::endgroup::
`)
assert.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "bye"}))
t.Log(buff.String())
assert.Equal(t, strings.TrimSpace(buff.String()), expectedOutputOrder)
}