1
0
mirror of https://github.com/go-task/task.git synced 2025-06-15 00:15:10 +02:00

Move path expanding logic to shell.Expand

This commit is contained in:
Andrey Nering
2018-07-15 15:37:20 -03:00
parent 18961e3d07
commit 67105b332f
5 changed files with 33 additions and 27 deletions

View File

@ -12,6 +12,7 @@ import (
"github.com/go-task/task"
"github.com/go-task/task/internal/taskfile"
"github.com/mitchellh/go-homedir"
"github.com/stretchr/testify/assert"
)
@ -412,3 +413,22 @@ func TestTaskVersion(t *testing.T) {
})
}
}
func TestExpand(t *testing.T) {
const dir = "testdata/expand"
home, err := homedir.Dir()
if err != nil {
t.Errorf("Couldn't get $HOME: %v", err)
}
var buff bytes.Buffer
e := task.Executor{
Dir: dir,
Stdout: &buff,
Stderr: &buff,
}
assert.NoError(t, e.Setup())
assert.NoError(t, e.Run(taskfile.Call{Task: "pwd"}))
assert.Equal(t, home, strings.TrimSpace(buff.String()))
}