1
0
mirror of https://github.com/go-task/task.git synced 2025-11-23 22:24:45 +02:00

add custom Cmd and Dep types

This commit is contained in:
Andrey Nering
2017-07-02 15:30:50 -03:00
parent a3bfa13670
commit 196d3cb13d
10 changed files with 245 additions and 53 deletions

View File

@@ -166,3 +166,35 @@ func TestInit(t *testing.T) {
t.Errorf("Taskfile.yml should exists")
}
}
func TestParams(t *testing.T) {
const dir = "testdata/params"
var files = []struct {
file string
content string
}{
{"hello.txt", "Hello\n"},
{"world.txt", "World\n"},
{"exclamation.txt", "!\n"},
{"dep1.txt", "Dependence1\n"},
{"dep2.txt", "Dependence2\n"},
}
for _, f := range files {
_ = os.Remove(filepath.Join(dir, f.file))
}
e := task.Executor{
Dir: dir,
Stdout: ioutil.Discard,
Stderr: ioutil.Discard,
}
assert.NoError(t, e.ReadTaskfile())
assert.NoError(t, e.Run("default"))
for _, f := range files {
content, err := ioutil.ReadFile(filepath.Join(dir, f.file))
assert.NoError(t, err)
assert.Equal(t, f.content, string(content))
}
}