1
0
mirror of https://github.com/go-task/task.git synced 2025-02-13 13:59:32 +02:00

move expectations for output to testdata

This commit is contained in:
jaedle 2019-02-24 14:18:07 +01:00
parent 0a808b1212
commit b05fa0821d
2 changed files with 6 additions and 4 deletions

View File

@ -95,7 +95,7 @@ func (e *Executor) printTaskDetails(task string) {
displayTaskDetailedDescription(s, Logger)
e.Logger.Outf("")
e.Logger.Outf("Commands:")
e.Logger.Outf("commands:")
}
func displayTaskDetailedDescription(description string, Logger *logger.Logger) {

View File

@ -580,9 +580,11 @@ func TestDetails(t *testing.T) {
}
assert.NoError(t, e.Setup())
buff.Reset()
exp, err := ioutil.ReadFile(dir + "/expected-task-with-details-details.txt")
assert.NoError(t, err, "error reading text fixture")
assert.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "task-with-details"}))
assert.Equal(t, "task: task-with-details\n\ndetails of task-with-details - line 1\n"+"line 2\n"+"line 3\n\nCommands:\n", buff.String())
assert.Equal(t, string(exp), buff.String())
assert.NotContains(t, buff.String(), "task-with-details was executed")
assert.NotContains(t, buff.String(), "dependend-task was executed")
@ -601,6 +603,6 @@ func TestDetails(t *testing.T) {
buff.Reset()
assert.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "task-with-description-containing-empty-line"}))
assert.Equal(t, "task: task-with-description-containing-empty-line\n\nFirst line followed by empty line\n\nLast Line\n\nCommands:\n", buff.String())
assert.Equal(t, "task: task-with-description-containing-empty-line\n\nFirst line followed by empty line\n\nLast Line\n\ncommands:\n", buff.String())
}