1
0
mirror of https://github.com/go-task/task.git synced 2025-01-04 03:48:02 +02:00

refactoring

This commit is contained in:
jaedle 2019-02-24 14:20:39 +01:00
parent 6fb53a406b
commit b2edbf05a1

View File

@ -580,8 +580,7 @@ func TestDetails(t *testing.T) {
}
assert.NoError(t, e.Setup())
exp, err := ioutil.ReadFile(dir + "/expected-task-with-details-details.txt")
assert.NoError(t, err, "error reading text fixture")
exp := readTestFixture(t, dir, "expected-task-with-details-details.txt")
assert.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "task-with-details"}))
assert.Equal(t, string(exp), buff.String())
@ -603,3 +602,9 @@ func TestDetails(t *testing.T) {
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())
}
func readTestFixture(t *testing.T, dir string, file string) []byte {
exp, err := ioutil.ReadFile(dir + "/" + file)
assert.NoError(t, err, "error reading text fixture")
return exp
}