mirror of
https://github.com/go-task/task.git
synced 2025-02-03 13:22:11 +02:00
Fix summary test on Windows
This commit is contained in:
parent
3c882e5c57
commit
5285ec23ae
14
task_test.go
14
task_test.go
@ -7,6 +7,7 @@ import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
@ -608,13 +609,16 @@ func TestSummary(t *testing.T) {
|
||||
}
|
||||
assert.NoError(t, e.Setup())
|
||||
assert.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "task-with-summary"}, taskfile.Call{Task: "other-task-with-summary"}))
|
||||
assert.Equal(t, readTestFixture(t, dir, "task-with-summary.txt"), buff.String())
|
||||
|
||||
data, err := ioutil.ReadFile(filepath.Join(dir, "task-with-summary.txt"))
|
||||
assert.NoError(t, err)
|
||||
|
||||
expectedOutput := string(data)
|
||||
if runtime.GOOS == "windows" {
|
||||
expectedOutput = strings.Replace(expectedOutput, "\r\n", "\n", -1)
|
||||
}
|
||||
|
||||
func readTestFixture(t *testing.T, dir string, file string) string {
|
||||
b, err := ioutil.ReadFile(dir + "/" + file)
|
||||
assert.NoError(t, err, "error reading text fixture")
|
||||
return string(b)
|
||||
assert.Equal(t, expectedOutput, buff.String())
|
||||
}
|
||||
|
||||
func TestWhenNoDirAttributeItRunsInSameDirAsTaskfile(t *testing.T) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user