From 31ecf167ccb5c3f2af75ae0fb44dc3a64f16f471 Mon Sep 17 00:00:00 2001 From: jaedle Date: Sun, 24 Feb 2019 15:54:11 +0100 Subject: [PATCH] rename to summary in test fixtures --- task.go | 2 +- task_test.go | 32 +++++++++---------- testdata/summary/Taskfile.yml | 18 +++++------ ...sk-with-summary-containing-empty-line.txt} | 2 +- ...with-details.txt => task-with-summary.txt} | 6 ++-- 5 files changed, 30 insertions(+), 30 deletions(-) rename testdata/summary/{task-with-description-containing-empty-line.txt => task-with-summary-containing-empty-line.txt} (57%) rename testdata/summary/{task-with-details.txt => task-with-summary.txt} (53%) diff --git a/task.go b/task.go index 0c970cd9..1a68ada2 100644 --- a/task.go +++ b/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 } diff --git a/task_test.go b/task_test.go index bbbd4d0e..9a51886f 100644 --- a/task_test.go +++ b/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()) } diff --git a/testdata/summary/Taskfile.yml b/testdata/summary/Taskfile.yml index bca2dca3..28cec378 100644 --- a/testdata/summary/Taskfile.yml +++ b/testdata/summary/Taskfile.yml @@ -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 diff --git a/testdata/summary/task-with-description-containing-empty-line.txt b/testdata/summary/task-with-summary-containing-empty-line.txt similarity index 57% rename from testdata/summary/task-with-description-containing-empty-line.txt rename to testdata/summary/task-with-summary-containing-empty-line.txt index 6915ebe7..8eca5e86 100644 --- a/testdata/summary/task-with-description-containing-empty-line.txt +++ b/testdata/summary/task-with-summary-containing-empty-line.txt @@ -1,4 +1,4 @@ -task: task-with-description-containing-empty-line +task: task-with-summary-containing-empty-line First line followed by empty line diff --git a/testdata/summary/task-with-details.txt b/testdata/summary/task-with-summary.txt similarity index 53% rename from testdata/summary/task-with-details.txt rename to testdata/summary/task-with-summary.txt index 437d85cb..c01eba06 100644 --- a/testdata/summary/task-with-details.txt +++ b/testdata/summary/task-with-summary.txt @@ -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