mirror of
https://github.com/go-task/task.git
synced 2025-01-22 05:10:17 +02:00
refactoring
This commit is contained in:
parent
b2edbf05a1
commit
8dd87dc482
11
task_test.go
11
task_test.go
@ -579,11 +579,8 @@ func TestDetails(t *testing.T) {
|
|||||||
Silent: true,
|
Silent: true,
|
||||||
}
|
}
|
||||||
assert.NoError(t, e.Setup())
|
assert.NoError(t, e.Setup())
|
||||||
|
|
||||||
exp := readTestFixture(t, dir, "expected-task-with-details-details.txt")
|
|
||||||
|
|
||||||
assert.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "task-with-details"}))
|
assert.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "task-with-details"}))
|
||||||
assert.Equal(t, string(exp), buff.String())
|
assert.Equal(t, readTestFixture(t, dir, "expected-task-with-details-details.txt"), buff.String())
|
||||||
|
|
||||||
buff.Reset()
|
buff.Reset()
|
||||||
const noDetails = "task-without-details"
|
const noDetails = "task-without-details"
|
||||||
@ -603,8 +600,8 @@ func TestDetails(t *testing.T) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func readTestFixture(t *testing.T, dir string, file string) []byte {
|
func readTestFixture(t *testing.T, dir string, file string) string {
|
||||||
exp, err := ioutil.ReadFile(dir + "/" + file)
|
b, err := ioutil.ReadFile(dir + "/" + file)
|
||||||
assert.NoError(t, err, "error reading text fixture")
|
assert.NoError(t, err, "error reading text fixture")
|
||||||
return exp
|
return string(b)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user