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

Merge branch 'master' into master

This commit is contained in:
Andrey Nering
2018-08-05 11:32:07 -03:00
committed by GitHub
6 changed files with 44 additions and 1 deletions

View File

@@ -455,3 +455,26 @@ func TestExpand(t *testing.T) {
assert.NoError(t, e.Run(taskfile.Call{Task: "pwd"}))
assert.Equal(t, home, strings.TrimSpace(buff.String()))
}
func TestDry(t *testing.T) {
const dir = "testdata/dry"
file := filepath.Join(dir, "file.txt")
_ = os.Remove(file)
var buff bytes.Buffer
e := task.Executor{
Dir: dir,
Stdout: &buff,
Stderr: &buff,
Dry: true,
}
assert.NoError(t, e.Setup())
assert.NoError(t, e.Run(taskfile.Call{Task: "build"}))
assert.Equal(t, "touch file.txt", strings.TrimSpace(buff.String()))
if _, err := os.Stat(file); err == nil {
t.Errorf("File should not exist %s", file)
}
}