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:
20
task_test.go
20
task_test.go
@ -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()))
|
||||
}
|
||||
|
Reference in New Issue
Block a user