mirror of
https://github.com/go-task/task.git
synced 2024-12-04 10:24:45 +02:00
rename to summary in test fixtures
This commit is contained in:
parent
3999480d64
commit
31ecf167cc
2
task.go
2
task.go
@ -85,7 +85,7 @@ func (e *Executor) printTaskSummary(task string) {
|
||||
t := e.Taskfile.Tasks[task]
|
||||
s := t.Summary
|
||||
if s == "" {
|
||||
e.Logger.Errf("task: There is no detailed description for task: %s", task)
|
||||
e.Logger.Errf("task: There is no summary for task: %s", task)
|
||||
return
|
||||
}
|
||||
|
||||
|
32
task_test.go
32
task_test.go
@ -554,7 +554,7 @@ func TestIncludesCallingRoot(t *testing.T) {
|
||||
tt.Run(t)
|
||||
}
|
||||
|
||||
func TestDetailsParsing(t *testing.T) {
|
||||
func TestSummaryParsing(t *testing.T) {
|
||||
const dir = "testdata/summary"
|
||||
|
||||
e := task.Executor{
|
||||
@ -562,12 +562,12 @@ func TestDetailsParsing(t *testing.T) {
|
||||
}
|
||||
assert.NoError(t, e.Setup())
|
||||
|
||||
assert.Equal(t, e.Taskfile.Tasks["task-with-details"].Summary, "details of task-with-details - line 1\nline 2\nline 3\n")
|
||||
assert.Equal(t, e.Taskfile.Tasks["other-task-with-details"].Summary, "details of other-task-with-details")
|
||||
assert.Equal(t, e.Taskfile.Tasks["task-without-details"].Summary, "")
|
||||
assert.Equal(t, e.Taskfile.Tasks["task-with-summary"].Summary, "summary of task-with-summary - line 1\nline 2\nline 3\n")
|
||||
assert.Equal(t, e.Taskfile.Tasks["other-task-with-summary"].Summary, "summary of other-task-with-summary")
|
||||
assert.Equal(t, e.Taskfile.Tasks["task-without-summary"].Summary, "")
|
||||
}
|
||||
|
||||
func TestDetails(t *testing.T) {
|
||||
func TestSummary(t *testing.T) {
|
||||
const dir = "testdata/summary"
|
||||
|
||||
var buff bytes.Buffer
|
||||
@ -579,24 +579,24 @@ func TestDetails(t *testing.T) {
|
||||
Silent: true,
|
||||
}
|
||||
assert.NoError(t, e.Setup())
|
||||
assert.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "task-with-details"}))
|
||||
assert.Equal(t, readTestFixture(t, dir, "task-with-details.txt"), buff.String())
|
||||
assert.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "task-with-summary"}))
|
||||
assert.Equal(t, readTestFixture(t, dir, "task-with-summary.txt"), buff.String())
|
||||
|
||||
buff.Reset()
|
||||
const noDetails = "task-without-details"
|
||||
assert.NoError(t, e.Run(context.Background(), taskfile.Call{Task: noDetails}))
|
||||
assert.Equal(t, "task: There is no detailed description for task: "+noDetails+"\n", buff.String())
|
||||
const nosummary = "task-without-summary"
|
||||
assert.NoError(t, e.Run(context.Background(), taskfile.Call{Task: nosummary}))
|
||||
assert.Equal(t, "task: There is no summary for task: "+nosummary+"\n", buff.String())
|
||||
|
||||
buff.Reset()
|
||||
const firstTask = "other-task-with-details"
|
||||
const secondTask = "task-with-details"
|
||||
const firstTask = "other-task-with-summary"
|
||||
const secondTask = "task-with-summary"
|
||||
assert.NoError(t, e.Run(context.Background(), taskfile.Call{Task: firstTask}, taskfile.Call{Task: secondTask}))
|
||||
assert.Contains(t, buff.String(), "details of "+firstTask)
|
||||
assert.NotContains(t, buff.String(), "details of "+secondTask)
|
||||
assert.Contains(t, buff.String(), "summary of "+firstTask)
|
||||
assert.NotContains(t, buff.String(), "summary of "+secondTask)
|
||||
|
||||
buff.Reset()
|
||||
assert.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "task-with-description-containing-empty-line"}))
|
||||
assert.Equal(t, readTestFixture(t, dir, "task-with-description-containing-empty-line.txt"), buff.String())
|
||||
assert.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "task-with-summary-containing-empty-line"}))
|
||||
assert.Equal(t, readTestFixture(t, dir, "task-with-summary-containing-empty-line.txt"), buff.String())
|
||||
|
||||
}
|
||||
|
||||
|
18
testdata/summary/Taskfile.yml
vendored
18
testdata/summary/Taskfile.yml
vendored
@ -1,20 +1,20 @@
|
||||
version: 2
|
||||
tasks:
|
||||
task-with-details:
|
||||
task-with-summary:
|
||||
deps: [dependend-task-1,dependend-task-2]
|
||||
summary: |
|
||||
details of task-with-details - line 1
|
||||
summary of task-with-summary - line 1
|
||||
line 2
|
||||
line 3
|
||||
cmds:
|
||||
- echo 'task-with-details was executed'
|
||||
- echo 'task-with-summary was executed'
|
||||
- echo 'another command'
|
||||
- exit 0
|
||||
|
||||
task-without-details:
|
||||
task-without-summary:
|
||||
deps: [dependend-task]
|
||||
cmds:
|
||||
- echo 'task-without-details was executed'
|
||||
- echo 'task-without-summary was executed'
|
||||
|
||||
dependend-task-1:
|
||||
cmds:
|
||||
@ -24,12 +24,12 @@ tasks:
|
||||
cmds:
|
||||
- echo 'dependend-task-2 was executed'
|
||||
|
||||
other-task-with-details:
|
||||
summary: details of other-task-with-details
|
||||
other-task-with-summary:
|
||||
summary: summary of other-task-with-summary
|
||||
cmds:
|
||||
- echo 'other-task-with-details was executed'
|
||||
- echo 'other-task-with-summary was executed'
|
||||
|
||||
task-with-description-containing-empty-line:
|
||||
task-with-summary-containing-empty-line:
|
||||
summary: |
|
||||
First line followed by empty line
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
task: task-with-description-containing-empty-line
|
||||
task: task-with-summary-containing-empty-line
|
||||
|
||||
First line followed by empty line
|
||||
|
@ -1,6 +1,6 @@
|
||||
task: task-with-details
|
||||
task: task-with-summary
|
||||
|
||||
details of task-with-details - line 1
|
||||
summary of task-with-summary - line 1
|
||||
line 2
|
||||
line 3
|
||||
|
||||
@ -9,6 +9,6 @@ dependencies:
|
||||
- dependend-task-2
|
||||
|
||||
commands:
|
||||
- echo 'task-with-details was executed'
|
||||
- echo 'task-with-summary was executed'
|
||||
- echo 'another command'
|
||||
- exit 0
|
Loading…
Reference in New Issue
Block a user