1
0
mirror of https://github.com/go-task/task.git synced 2025-06-15 00:15:10 +02:00

Merge branch 'f/list-all' of https://github.com/therealkevinard/task into therealkevinard-f/list-all

This commit is contained in:
Andrey Nering
2022-01-04 17:03:12 -03:00
5 changed files with 102 additions and 6 deletions

View File

@ -518,10 +518,58 @@ func TestLabelInList(t *testing.T) {
Stderr: &buff,
}
assert.NoError(t, e.Setup())
e.PrintTasksHelp()
e.PrintTasksHelp(false)
assert.Contains(t, buff.String(), "foobar")
}
// task -al case 1: listAll list all tasks
func TestListAllShowsNoDesc(t *testing.T) {
const dir = "testdata/list_mixed_desc"
var buff bytes.Buffer
e := task.Executor{
Dir: dir,
Stdout: &buff,
Stderr: &buff,
}
assert.NoError(t, e.Setup())
var title string
e.ListAllTasks()
for _, title = range []string{
"foo",
"voo",
"doo",
} {
assert.Contains(t, buff.String(), title)
}
}
// task -al case 2: !listAll list some tasks (only those with desc)
func TestListCanListDescOnly(t *testing.T) {
const dir = "testdata/list_mixed_desc"
var buff bytes.Buffer
e := task.Executor{
Dir: dir,
Stdout: &buff,
Stderr: &buff,
}
assert.NoError(t, e.Setup())
e.ListTasksWithDesc()
var title string
assert.Contains(t, buff.String(), "foo")
for _, title = range []string{
"voo",
"doo",
} {
assert.NotContains(t, buff.String(), title)
}
}
func TestStatusVariables(t *testing.T) {
const dir = "testdata/status_vars"