1
0
mirror of https://github.com/go-task/task.git synced 2025-11-25 22:32:55 +02:00

Add --init flag to create a new Taskfile

This commit is contained in:
Andrey Nering
2017-05-17 15:38:46 -03:00
parent 83f1b213fa
commit 2615000609
6 changed files with 59 additions and 1 deletions

View File

@@ -144,3 +144,22 @@ func TestStatus(t *testing.T) {
t.Errorf("Wrong output message: %s", buff.String())
}
}
func TestInit(t *testing.T) {
const dir = "testdata/init"
var file = filepath.Join(dir, "Taskfile.yml")
_ = os.Remove(file)
if _, err := os.Stat(file); err == nil {
t.Errorf("Taskfile.yml should not exists")
}
c := exec.Command("task", "--init")
c.Dir = dir
if err := c.Run(); err != nil {
t.Error(err)
}
if _, err := os.Stat(file); err != nil {
t.Errorf("Taskfile.yml should exists")
}
}