mirror of
https://github.com/go-task/task.git
synced 2025-08-10 22:42:19 +02:00
add tests to previous
This commit is contained in:
50
task_test.go
50
task_test.go
@@ -474,10 +474,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.PrintTasksHelp(true)
|
||||
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.PrintTasksHelp(false)
|
||||
|
||||
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"
|
||||
|
||||
|
12
testdata/list_mixed_desc/Taskfile.yml
vendored
Normal file
12
testdata/list_mixed_desc/Taskfile.yml
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
version: '3'
|
||||
|
||||
tasks:
|
||||
foo:
|
||||
label: "foobar"
|
||||
desc: "foo has desc and label"
|
||||
|
||||
voo:
|
||||
label: "voo has no desc"
|
||||
|
||||
doo:
|
||||
label: "doo has desc, no label"
|
Reference in New Issue
Block a user